Leave a comment at the end of this page or email contact@krishagni.com
Initialise values based on other fields
OpenSpecimen allows the initialization of field values using other field values (core or custom fields).
For example:
- The visit date can be set to default as the registration date.
- Specimen collection date => Registration date/Visit date
- Created on => Registration date
- Accession date (custom field) => Registration date/Visit date
Example 1: By using "defaultValue": "field:visit.visitDate", the collection date is set to show visit date as the default value.
{ "name": "specimen.collectionEvent.time", "caption": "Collection Time", "type": "datetime", "defaultValue": "field:visit.visitDate", //visit date value will be displayed as default "optional": true, "showIf": { "op": "AND", "rules": [ { "field": "specimen.lineage", "op": "==", "value": "'New'" } ] } }
Example 2: By using "defaultValue" : "field: specimen.parent.extensionDetail.attrsMap.ST2" code in "derivedSpecimens" section, the custom field value from parent specimen will be defaulted to its derived specimens.
Note:
- To make this code work, you need to create parent specimens first.
- Once you create the parent specimen, you can add derivatives/aliquots.
{ "name" : "specimen.extensionDetail.attrsMap.ST2", "baseField" : "specimen.extensionDetail.attrsMap.ST2", "caption" : "Cell Line ID", "defaultValue" : "field: specimen.parent.extensionDetail.attrsMap.ST2", "width" : "80px", "optional" : false },
Example 3: By using "defaultValue" : "field: specimen.parent.initialQty" code in "derivedSpecimens" section, the initial quantity value from the parent specimen will be defaulted to its derived specimens.
Note:
- To make this code work, you need to create parent specimens first.
- Once you create the parent specimen, you can add derivatives/aliquots.
{ "name" : "specimen.initialQty", "caption" : "Quantity", "type" : "specimen-quantity", "defaultValue" : "field: specimen.parent.initialQty", "optional" : true },
Leave a comment at the end of this page or email contact@krishagni.com