Research-IT-Swiss-TPH / redcap-unique-actiontag

A REDCap external module providing action tags that make fields unique.
2 stars 1 forks source link
redcap redcap-external-module redcap-repo

Unique Action Tag

A REDCap external module providing action tags that render fields unique with custom conditions. The External Module version 3 has been rewritten from scratch and reduces all ActionTags to a single one with an extended API.

Warning: If you are upgrading from version 2 to version 3 there are breaking changes in the way the ActionTag is beeing used. Please ensure you migrate accordingly to the new @UNIQUE API.

Default behaviour

The new default behaviour of the @UNIQUE Action Tag is:

Usage

The "with_" flags can be used to enable complete checks against all records , instances or events:

"with_all_records":true

"with_all_instances":true

"with_all_events":true

Additional customizations can be configured with:

"targets": ["field_1", "field_2"]

"title": "This is a title"

"message": "This is a message."

Examples

Example 1: Checks uniqueness across all records except within current record, for the current instance and event.

@UNIQUE

Example 2: Checks uniqueness within same record against addtional fields "field_1" and "field_2", across all instances and events. A custom dialog with "title" and "message" will be triggered.

@UNIQUE={
    "with_all_records": true,
    "with_all_instances": true,
    "with_all_events": true,
    "targets": ["field_1", "field_2"],
    "title": "This is a title",
    "message": "This is a message."
}