Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The anticipated/pending visits from the visit table are configurable based on specific values selected in one or more fields. These fields can be static or custom fields at the participant level.

...

Add the below-mentioned code block in the

...

“visitsTab” section.

Expand
titleExpand for the code.
Code Block
languagejson
{
     "name": "visitsTab",
     "data": {
       "occurred": [
         {
           "field": "visit.name",
           "baseField": "visit.name",
           "width": "150px"
         },
         {
           "field": "visit.visitDate",
           "baseField": "visit.visitDate",
           "width": "100px"
         }
       ],
       "anticipatedEvents": [
           {
             "rule": "cpr.participant.gender == 'Female'",
             "events": ["S01" , "MFW","D01"]
           },
           {
             "rule": "cpr.participant.gender == 'Male'",
             "events": ["S01" , "PFW"]
           }
       ]
     }
   }

After adding the above JSON, the visit table on the participant overview page would look like the screenshot added below:

Case 1: 'Gender' = 'Female'

Image Added

Case 2: 'Gender' = 'Male'

Image Added

Note:

  • The "rule" “rule” specifies the participant criteria: In this case, “cpr.participant.gender “ is the field and “Female" “Female” is the value of that field. So, based on gender, visits are hidden and shown in the visit table.

  • The "events" “events” specifies the list of events (codes) to be displayed.

  • Every time, the first matching rule is used. When no rules match, all the events are displayed.

  • If the event code is not specified, it will always be displayed in the anticipated visit table.

Case 1: 'Gender' = 'Female'

After adding the above JSON, the visit table on the participant overview page would look like the screenshot added below:

...

Case 2: 'Gender' = 'Male'

...

For multi-select custom fields, use the following JSON code in 'rule':

In the below case, ‘cpr.participant.extensionDetail.attrsMap.MLB18’ is a multi-select field, and 'ABC' is the value of the field.

...

languagejson

...

For Multi-select Custom fields

Below code can be used to set up the show/hide events based on multi-select field.

Expand
titleExpand for the code.
Code Block
languagejson
{
  "name" : "visitsTab",
  "view" : null,
  "ctrl" : null,
  "data" : {
    "anticipatedEvents" : {
      "matchType" : "all",
      "rules" : [ {
        "rule" : "cpr.participant.extensionDetail.attrsMap.marital_status_.indexOf('Married') > -1",
        "events" : [ "C1", "C2", "C3" ]
      }, {
        "rule" : "cpr.participant.extensionDetail.attrsMap.marital_status_.indexOf('Unmarried') > -1",
        "events" : [ "C1", "C3" ]
      }, {
        "rule" : "cpr.participant.extensionDetail.attrsMap.marital_status_.indexOf('Enganged') > -1",
        "events" : [ "C4", "C5" ]
      }, {
        "rule" : "cpr.participant.extensionDetail.attrsMap.
MLB18
marital_status_.indexOf('
ABC
Widow') 
!=
> -1",
        "events" : [ "
E01","E02"] }

Example JSON

...

C6", "C7", "C8", "C1" ]
      }, {
        "rule" : "*",
        "events" : [ "C9" ]
      } ]
    }
  }
}

Note

  1. Rules can be set up to use events of: The first matching rule (matchType = any) OR All the matching rules (matchType = all).

  2. The rule = "*” is a wildcard for catch all.

  3. If no matchType specified/configured, the default setting “any” is considered.