Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Current »

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 for the code.
{
     "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'

Case 2: 'Gender' = 'Male'

Note:

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

  • The “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.

For Multi-select Custom fields

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

 Expand for the code.
{
  "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.marital_status_.indexOf('Widow') > -1",
        "events" : [ "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.

  • No labels