/
Initialise values based on other fields
Got feedback or spotted a mistake?

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:

  1. To make this code work, you need to create parent specimens first.
  2. 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:

  1. To make this code work, you need to create parent specimens first.
  2. 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
      },

Related content

Hide/Set default value to specimen fields
Hide/Set default value to specimen fields
More like this
Populate the value based on the selection of other field value/s
Populate the value based on the selection of other field value/s
Read with this
Configure derivative and aliquot page
Configure derivative and aliquot page
More like this
Skip Specimen Collection Page
Skip Specimen Collection Page
Read with this
Configuring Fields in Specimen Table and Tree (TO DO)
Configuring Fields in Specimen Table and Tree (TO DO)
More like this
Define Defaults on Unplanned Specimen Page
Define Defaults on Unplanned Specimen Page
Read with this
Got feedback or spotted a mistake?

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