Skip to content

Barcode

Benjamin Mwalimu edited this page May 10, 2021 · 1 revision

Number Selector Field

This is an android input field that is identified by type barcode in the JSON. This is field is a .

Field attributes

Field Attribute Usage Required
key Unique of the field yes
type Type of the field yes
number_of_selectors Configures the number of selection number to be display yes
start_number Determines the initial number on the the number selectors list yes
max_value Configures the maximum value of the number selector dropdown yes
text_size Sets the text size in pixels no
text_color Helps set a different text colour other than the one set for the predefined toaster notes no
selected_text_color Sets the selected text text color no
value Holds the user entry. It's a string literal. Only needed in case the field has a predefined entry otherwise it's always auto-generated/automatically added through code yes
relevance Holds the rules to show/hide the specific field. This can use rules engine/ the line relevance no
v_required Status to indicate whether this field is required or not no
relevance Holds the rules to show/hide the specific field. This can use rules engine/ the line relevance no
calculations Holds the link to the rules files that has a calculation affects the field in question no
openmrs_entity_parent Holds the concept id of the parent concept in OpenMRS yes
openmrs_entity Holds the entity type on OpenMRS e.g Person, Address, Concept yes
openmrs_entity_id Holds the concept id from OpenMRS no

Example JSON

{
  "key": "children",
  "openmrs_entity_parent": "",
  "openmrs_entity": "",
  "openmrs_entity_id": "",
  "type": "numbers_selector",
  "number_of_selectors": "5",
  "start_number": "1",
  "max_value": "20",
  "text_size": "18px",
  "text_color": "#000000",
  "selected_text_color": "#ffffff",
  "v_required": {
    "value": true
  },
  "value": "3",
  "relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  },
  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }
}

Required Status

To make a field required add v_required attribute with value true. The text on the err attribute will be displayed to the user in case the field is not filled.

Rules

Calculations

  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.

Relevance

"relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.