...
Code Block |
---|
{
"name" : "specimen.extensionDetail.attrsMap.made_method",
"caption" : "Made Method",
"type" : "dropdown",
"showInOverviewIf": "useShowIf",
"showIf": {
"op": "AND",
"rules": [
{
"field": "specimen.lineage",
"op": "==",
"value": "'Aliquot'"
},
{
"field" : "specimen.type",
"op" : ".search('RNA|DNA')!=",
"value" : "-1"
}
]
},
"optional" : true,
"listSource" : {
"apiUrl" : "forms/permissible-values",
"selectProp" : "value",
"displayProp" : "value",
"queryParams" : {
"dynamic" : { },
"static" : {
"formName" : "epidemiology_specimen_custom_form",
"controlName" : "made_method"
}
}
}
}, |
Show/Hide custom field – Using Regex Matching
Show the 'Lived Name' custom field only when the PPID starts with 'J'.
Example code
...
Hide Custom Field For Newer Data Entry
Once legacy data is added, the custom field may become unnecessary for new entries, but should remain visible for existing records with values.
Expand |
---|
|
Example Code Code Block |
---|
{
"name" : "specimen.extensionDetail.attrsMap. | livednameLived NameCore Size (mm)",
"type" : "text",
| "optional":"true",: {
"op": "AND",
"rules": [
{
: "!!specimen.extensionDetail.attrsMap.core_size_mm",
" | fieldcpr.ppid,
op".search('^J') !=", // Modify the regex in single quote as per requirement.
"value": "-1"
}
]
}
}
|
Show/Hide Custom field based on CP site
Expand |
---|
#1. When CP SiteName is an Amol site, then only it will show the custom field 'Live Nucleated Count (MCells)'. Code: Code Block |
---|
{
"name": "specimen.extensionDetail.attrsMap.post_processing_nucleated_count",
"caption": "Live Nucleated Count (MCells)",
"type": "text",
"attr": "post_processing_nucleated_count",
"optional": true,
"showIf": {
"op": "NOT",
"rules": [
{
"field": "cp.siteName",
"op": "!=",
"value": "'Amol site'"
}
]
},
"showInOverviewIf": "useShowIf"
} |
Screenshot: Image Removed#2. When CP SiteName is not Amol site, then not show the custom field 'Live Nucleated Count (MCells)'. Code: Code Block |
---|
{
"name": "specimen.extensionDetail.attrsMap.post_processing_nucleated_count",
"caption": "Live Nucleated Count (MCells)",
"type": "text",
"attr": "post_processing_nucleated_count",
"optional": true,
"showIf": {
"op": "NOT",
"rules": [
{
"field": "cp.siteName",
"op": "==",
true,
} |
Displays the "Core Size (mm)" field in the edit and overview page only if it has a value. Explaination: Uses the double negation (!! ) to check whether core_size_mm has a true value. If core_size_mm is empty, null, or undefined, this condition will evaluate to false , preventing the field from displaying in edit and overview page. |
Show/Hide custom field – Using Regex Matching
Show the 'Lived Name' custom field only when the PPID starts with 'J'.
Example code
Code Block |
---|
{
"name": "cpr.participant.extensionDetail.attrsMap.lived_name",
"caption": "Lived Name",
"type": "text",
"optional": "true",
"showIf": {
"op": "AND",
"rules": [
{
" valuefield": " 'Amol site'"
cpr.ppid",
"op": ".search('^J') !=", } // Modify the regex in single quote as per requirement. ]
},
"value": "-1"
}
"showInOverviewIf": "useShowIf" ]
}
} Screenshot: Image Removed
|
Example JSON
Download