/
Set default value for fields in dictionary
Got feedback or spotted a mistake?
Leave a comment at the end of this page or email contact@krishagni.com
Set default value for fields in dictionary
Amol Gayakwad
Owned by Amol Gayakwad
Apr 09, 2025
Introduction
The user can set default values for the fields in the dictionary section of the JSON file.
Example:
The default values for anatomic site, initial/available quantity, and collection container are set in the dictionary section, eliminating the need for users to enter these values manually during specimen collection or creation.
{
"name" : "dictionary",
"view" : null,
"ctrl" : null,
"data" : {
"fields" : [ {
"name" : "specimen.label",
"caption" : "Label",
"type" : "text",
"optional" : true,
"showIf" : {
"op" : "OR",
"rules" : [ {
"field" : "specimen.labelFmt",
"op" : "not_exist"
}, {
"field" : "cp.manualSpecLabelEnabled",
"op" : "exists"
} ]
}
}, {
"name" : "specimen.barcode",
"caption" : "Barcode",
"type" : "text",
"optional" : true,
"showIf" : {
"op" : "OR",
"rules" : [ {
"field" : "cp.barcodingEnabled",
"op" : "==",
"value" : "true"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.lineage",
"caption" : "Lineage",
"type" : "radio",
"optional" : false,
"options" : [ {
"value" : "New",
"caption" : "New"
}, {
"value" : "Derived",
"caption" : "Derived"
}, {
"value" : "Aliquot",
"caption" : "Aliquot"
} ]
}, {
"name" : "specimen.status",
"caption" : "Collection Status",
"type" : "dropdown",
"optional" : true,
"listSource" : {
"selectProp" : "value",
"displayProp" : "value",
"options" : [ {
"value" : "Collected"
}, {
"value" : "Missed Collection"
}, {
"value" : "Pending"
} ]
}
}, {
"name" : "specimen.type",
"caption" : "Type",
"type" : "specimen-type",
"specimen" : "specimen",
"optional" : false,
"defaultValue" : "Not Specified",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "!=",
"value" : "'Aliquot'"
} ]
}
}, {
"name" : "specimen.initialQty",
"caption" : "Initial Quantity",
"type" : "specimen-quantity",
"defaultValue": 1,
"specimen" : "specimen",
"optional" : true
}, {
"name" : "specimen.availableQty",
"caption" : "Available Quantity",
"defaultValue": 1,
"type" : "specimen-quantity",
"specimen" : "specimen",
"optional" : true
},
{
"name": "specimen.anatomicSite",
"caption": "Anatomical Site",
"type": "pvs",
"attr": "anatomic_site",
"optional": true,
"defaultValue": "Not Specified",
"showOnlyLeafValues": true,
"showIf": {
"op": "AND",
"rules": [
{
"field": "specimen.lineage",
"op": "!=",
"value": "'Aliquot'"
}
]
}
},
{
"name" : "specimen.parentLabel",
"caption" : "Parent Specimen",
"type" : "text",
"optional" : false,
"url" : "specimen({specimenId: specimen.parentId})",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "!=",
"value" : "'New'"
} ]
},
"modelOpts" : {
"updateOn" : "blur"
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.storageLocation",
"caption" : "Location",
"type" : "storage-position",
"optional" : true,
"cpId" : "specimen.cpId",
"entity" : "specimen",
"url" : "container-detail.locations({containerId: specimen.storageLocation.id})",
"subFields" : [ {
"name" : "name",
"caption" : "Container Name"
}, {
"name" : "positionY",
"caption" : "Container Row"
}, {
"name" : "positionX",
"caption" : "Container Column"
} ]
}, {
"name" : "specimen.createdOn",
"caption" : "Created On",
"type" : "datetime",
"optional" : false,
"defaultValue" : "current_date",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "!=",
"value" : "'New'"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.freezeThawCycles",
"caption" : "Freeze Thaw Cycles",
"type" : "text",
"optional" : true,
"pattern" : "/^[0-9][0-9]*$/"
}, {
"name" : "specimen.incrParentFreezeThaw",
"caption" : "Increment parent specimen's Freeze/Thaw cycles?",
"type" : "radio",
"optional" : true,
"options" : [ {
"caption" : "Yes",
"value" : 1
}, {
"caption" : "No",
"value" : 0
} ],
"showInOverviewIf" : "!!specimen.incrParentFreezeThaw"
}, {
"name" : "specimen.comments",
"caption" : "Comments",
"type" : "textarea",
"optional" : true
}, {
"name" : "specimen.collectionEvent.time",
"caption" : "Collection Date & Time",
"type" : "datetime",
"defaultValue" : "current_date",
"optional" : true,
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.collectionEvent.user",
"caption" : "Collector",
"type" : "user",
"defaultValue" : "current_user",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.collectionEvent.container",
"caption" : "Collection Container",
"type" : "pvs",
"attr" : "collection-container",
"optional" : true,
"defaultValue" : "Not Specified",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.collectionEvent.procedure",
"caption" : "Collection Procedure",
"type" : "pvs",
"attr" : "collection-procedure",
"defaultValue" : "Not Specified",
"optional" : true,
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.receivedEvent.user",
"caption" : "Receiver",
"type" : "user",
"defaultValue" : "current_user",
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf",
"subFields" : [ {
"name" : "emailAddress",
"caption" : "Collector Email Address"
} ]
}, {
"name" : "specimen.receivedEvent.time",
"caption" : "Received Date & Time",
"type" : "datetime",
"defaultValue" : "current_date",
"optional" : true,
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.receivedEvent.receivedQuality",
"caption" : "Received Quality",
"type" : "pvs",
"attr" : "received-quality",
"defaultValue" : "Acceptable",
"optional" : true,
"showIf" : {
"op" : "AND",
"rules" : [ {
"field" : "specimen.lineage",
"op" : "==",
"value" : "'New'"
}, {
"field" : "specimen.reqId",
"op" : "not_exist"
} ]
},
"showInOverviewIf" : "useShowIf"
}, {
"name" : "specimen.events.SpecimenFrozenEvent.time",
"caption" : "Frozen Time",
"type" : "datetime",
"defaultValue" : "current_date"
}, {
"name" : "specimen.events.SpecimenFrozenEvent.user",
"caption" : "Frozen By",
"type" : "user",
"defaultValue" : "current_user"
}, {
"name" : "specimen.events.SpecimenFrozenEvent.frozenMethod",
"caption" : "Frozen Method",
"type" : "pvs",
"attr" : "frozen_method",
"defaultValue" : "Liquid Nitrogen"
}, {
"name" : "specimen.events.SpecimenFrozenEvent.comments",
"caption" : "Frozen Comments",
"type" : "textarea"
}, {
"name" : "calcSpecimen.smoker",
"displayExpr" : "parent.specimen.extensionDetail.attrsMap.smoker",
"caption" : "Smoker test",
"type" : "span"
}, {
"name" : "specimen.extensionDetail.attrsMap.smoker",
"caption" : "Smoker?",
"type" : "dropdown",
"defaultValue" : "field: specimen.parent.extensionDetail.attrsMap.smoker",
"optional" : false,
"listSource" : {
"apiUrl" : "forms/permissible-values",
"selectProp" : "value",
"displayProp" : "value",
"queryParams" : {
"dynamic" : { },
"static" : {
"formName" : "testing_ali_form",
"controlName" : "smoker"
}
}
}
} ],
"onValueChange" : {
"specimen.extensionDetail.attrsMap.smoker" : [ "function(opts) {", " angular.forEach(opts.viewCtx.spmnCtx.aliquots, ", " function(aliquot) { ", " var user = opts.fns.get(opts.object, opts.field);", " opts.fns.set(aliquot, 'extensionDetail.attrsMap.FC15', user);", " }", " );", "}" ]
}
}
},
Screenshot:
, multiple selections available,
Got feedback or spotted a mistake?
Leave a comment at the end of this page or email contact@krishagni.com