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 9 Next »

You can show the field if dropdown values:

'Contains' condition

 Click here to expand

Below is the example code that shows the field at the visit level if 'Clinical Diagnosis' contains the word 'pregnancy'.

{
           "name" : "visit.extensionDetail.attrsMap.TA2",
           "caption" : "Any complications",
           "type" : "textarea",
           "optional" : true,
           "showIf" : {
             "op" : "AND",
             "rules" : [ {
               "field" : "visit.clinicalDiagnoses",
               "op" : ".join(',').indexOf('pregnancy')",
               "value" : "> -1"
             } ]
           },
           "showInOverviewIf": "useShowIf"
}

"op" : ".join(',').indexOf('pregnancy')": means show 'TA2' field when clinical diagnosis has 'pregnancy' word in the selected option.

'Is one of the value' condition:

 Click here to expand

Example 1: Below is the example code that shows the field at the visit level if 'Clinical Diagnosis' has '10 weeks gestation of pregnancy' value.

{
           "name" : "visit.extensionDetail.attrsMap.TA2",
           "caption" : "Any complications",
           "type" : "textarea",
           "optional" : true,
           "showIf" : {
             "op" : "AND",
             "rules" : [ {
               "field" : "visit.clinicalDiagnoses",
               "op" : ".indexOf('10 weeks gestation of pregnancy')",
               "value" : "> -1"
             } ]
           },
           "showInOverviewIf": "useShowIf"
  }

"op": ".indexOf('10 weeks gestation of pregnancy')": means show 'TA2' field when clinical diagnosis has '10 weeks gestation of pregnancy' value.

Example 2: Suppose you want to display fields on the nth step page when only specified specimen types are selected.

{
  "name" : "specimenCollection",
  "view" : null,
  "ctrl" : null,
  "data" : {
    "fieldGroups" : [ {
      "title" : "Processing Event for Frozen Samples",
      "criteria" : {
        "op" : "AND",
        "rules" : [ {
          "field" : "specimen.lineage",
          "op" : "==",
          "value" : "'Derived'"
        }, {
          "field" : "['Frozen Tissue', 'Frozen Tissue Slide', 'Frozen Tissue Block','Embedded in OCT', 'Swiss Role in OCT'].indexOf(specimen.type)",
          "op" : "!=",
          "value" : "-1"
        } ]
      },
      "fields" : [ {
        "name" : "specimen.label",
        "baseField" : "specimen.label",
        "type" : "span"
      }, {
        "name" : "specimen.type",
        "baseField" : "specimen.type",
        "type" : "span"
      }, {
        "name" : "specimen.createdOn",
        "baseField" : "specimen.createdOn",
        "caption" : "Processing Date and Time"
      } ]
    } ]
  }
}

Example 3: Show field on overview and hide on the data entry page.

{
      "name" : "cpr.participant.extensionDetail.attrsMap.ST10",
      "caption" : "Kindred ID",
      "type" : "text",
      "showIf" : {
        "op" : "AND",
        "rules" : [ {
          "field" : "cpr.participant.extensionDetail.attrsMap.ST10",
          "op" : "==",
          "value" : "'xxx"
        } ]
      },
      "optional" : true
    }, 

  • No labels