Leave a comment at the end of this page or email contact@krishagni.com
Configure Fields Based on Multiple Operators
If you want to display a field based on multiple operators on add/edit pages, you can achieve that using AND/OR operators.
AND Operator
Example 1: Display visit custom field based on conditions
The visit custom field (Visit Details) is displayed on add/edit page only when the below conditions are true:
The 'visit site' has to be 'JSON Testing'.
The event label should be 'Baseline' or 'Pre-Surgery'.
{
"name" : "visit.extensionDetail.attrsMap.ST2",
"caption" : "Visit Details",
"type" : "text",
"optional" : true,
"showInOverviewIf" : "useShowIf",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "visit.site",
"op" : "==",
"value" : "'JSON Testing'"
}, {
"field" : "visit.eventLabel",
"op" : ".search('Baseline|Pre-Surgery') != ",
"value" : "-1"
} ]
}
}
The overview screen will look like this:
Example 2: Display ethnicity field based on conditions
In this code, the 'Ethnicity' participant field is displayed on add/edit page based on the below conditions:
The 'Gender' has to be 'Unknown'.
The 'Race' should be 'White'.
{
"name": "cpr.participant.ethnicities",
"caption": "Ethnicity",
"type": "pvs",
"attr": "ethnicity",
"optional": true,
"multiple": true,
"showIf": {
"op": "And",
"rules": [
{
"field": "cpr.participant.races",
"op": "==",
"value": "'White'"
},
{
"field": "cpr.participant.gender",
"op": "==",
"value": "'Unknown'"
}
]
},
"showInOverviewIf": "useShowIf"
}
OR Operator
Example: Display death date field based on conditions
In this code, the 'Death Date' participant field is displayed on add/edit page based on the below conditions:
The ‘Vital Status' has to be 'Dead’ OR 'Unspecified'.
{
"name": "cpr.participant.deathDate",
"caption": "Death Date",
"type": "date",
"optional": true,
"showIf": {
"op": "OR",
"rules": [
{
"field": "cpr.participant.vitalStatus",
"op": "==",
"value": "'Dead'"
},
{
"field": "cpr.participant.vitalStatus",
"op": "==",
"value": "'Unspecified'"
}
]
},
"showInOverviewIf": "useShowIf"
}
Example JSON
Leave a comment at the end of this page or email contact@krishagni.com