Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack


Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
<obs conceptId="1234" answerConceptId="123" labelText="The question:" answerLabel="The answer"/>
Renders as: The question: [ ]The answer
If checked creates an obs with conceptId=1234 and valueCoded=123

<obs conceptId="1234"/>
Renders as a dropdown of all possible answer specified for concept 1234 in the dictionary

<obs conceptId="1234" answerConceptIds="123,7,912" answerLabels="Malaria,Tuberculosis,Diabetes"/>
Renders as a dropdown of the specified answers with the specified labels.

<obs conceptId="1296" answerClasses="Drug"/>
Renders as a dropdown all Concepts with ConceptClass = "Drug", ordered by Concept Name

<obs conceptId="1296" answerClasses="Drug" style="autocomplete"/>
Renders as a autocomplete widget with ConceptClass = "Drug"

<obs conceptId="1234" searchDrugsanswerDrugs="true"/>
Renders as an autocomplete widget that searches the Drug table, and will save the selected value in obs.value_drug
<obs conceptId="1234" searchDrugsanswerDrugs="true" displayTemplate="{{concept}} ({{doseStrength}} {{units}})"/>
Renders an an autocomplete widget, with items displayed using a custom handlebars template. (Default is "{{name}}".)


  • defaultValue: Specify a default value for Obs of any datatype
    • Values:
      • For numeric: Any numeric value
      • For boolean: "true" or "false"
      • For text: Any string
      • For date: "now" to use the current date and time; "today" to use the current date with time 00:00; a specific date in the format yyyy-MM-dd-HH-mm Note: For obs with a date datatype, defaultValue and defaultDateTime achieve the same result.
      • For coded: Valid Concept Integer ID, Concept Mapping, or Concept uuid
    • Examples:
      • <obs conceptId="3401" defaultValue="Hello World" />
      • <obs conceptId="3509" answerConceptId="2070" answerLabel="l'hôpital" style="checkbox" defaultValue="PIH: 2070" />
      • <obs conceptId="3201" labelText="" answerConceptIds="1175,1065,1066" style="radio" answerLabels="N/A,oui,non" defaultValue="PIH: 1065"/>
      • <obs conceptId="7417" defaultValue="2011-02-17-00-00"/>
      • <obs conceptId="1837" defaultValue="now"/> <obs conceptId="1271" answerConceptIds="678,729,653,654,849,1624" answerLabels="GB,Plaquettes,ALT/SGOT,AST/SGPT,Proteinuria,TSH" defaultValue="653"/>
    • Default: None
    • Version: Available since version 1.9.0
  • displayTemplate: how to format an autocomplete result
    • Only used when searchDrugsanswerDrugs="true"
    • Example: <obs concept="1234 searchDrugsanswerDrugs="true" displayTemplate="{{concept}} {{doseStrength}} {{units}}" />
    • Default: "{{name}}"
    • Version: since 2.1.6


  • rows: Number of rows in the textarea (implies style="textarea")
    • Example: <obs conceptId="3221" rows="7" cols="60" />
    • Value: Positive Integer
    • Default: None
  • searchDrugsanswerDrugs: for coded concepts, if true, displays an autocomplete widget to pick a drug as the obs value
    • Example: <obs conceptId="1234" searchDrugsanswerDrugs="true" />
    • Value: true or false
    • Default: false
    • Version: since 2.1.6