Shows properties for the selected item (page, question, or question option) in the Forms Pane.
...
The answer taken when the one filling the form has not supplied any. For Single Select/Multiple Select fields, the "Default Value" should be the "Binding" value of the default concept. Here is one example of the "Binding" for an OpenMRS system which assumes the use of the MVP-CIEL concept dictionary: For a Single Select field which has the options "NORMAL" and "ABNORMAL", where "NORMAL" should be the default value, set the field's "Default Value" to "1115^NORMAL^99DCT".
Calculation
This is only for those fields whose values are a result of some computation. For instance if we had three fields: Weight1, Weight2, Weight3.
Where Weight3 = Weight2 - Weight1.
Then the calculation property would be only for the Weight3 field and would be: /form/obs/weight2/value - /form/obs/weight1/value
You can use the "add field" link on the right hand side which lets you select a form field and it inserts the xpath expression for each field.
Another example to multiple or divide is the following (/form/obs/peso_kg/value * 10000) / (/form/obs/talla/value * /form/obs/talla/value)
Use of conditionals
Let's say you want to set Weight3 to 10 only when Weight2==10, else Weight3=0;
...
Code Block |
---|
(function () { if(/form/obs/weight2/value == 6101 || (/form/obs/weight3/value == 6101 && /form/obs/weight4/value == 6101) ) { value =return 4; } else if (/form/obs/weight2/value == 6102 || /form/obs/weight3/value == 6102) { valuereturn = 2; } } ) () |
If the field you are comparing with is a single or multiple select (for example if the question is a coded concept), then change 6101 to '6101^NAME^99DCT'
For max, set the calculation property to something like: Math.max(/new_form1/question1/value, /new_form1/question2/value)
For min, set the calculation property to something like: Math.min(/new_form1/question1/value, /new_form1/question2/value)
For sum, set the calculation property to something like: /new_form1/question1/value + /new_form1/question2/value
NOTES:
- There is a bug which requires you to have spaces on both sides of the equal signs. For instance, use: ...value == 6101 instead of ...value==6101. This also applies to the values above, where the /form/question1/value must have a space with the previous coma. So Math.max(/new_form1/question1/value,/new_form1/question2/value) will not work (no space between , and /new_form1/question2. but Math.max(/new_form1/question1/value, /new_form1/question2/value) will.
- All of the /form/question/value can be added by clicking on the Add Field link at the right of the calculate box and selecting the concept.
Description Template
A combination of any question answers and text which can be used to describe data collected in a form. This is mostly used for mobile devices which can have a list of data collected for the same form and use the property to enable the user to differentiate between the data items without having to first open and check each one by one. This is a property of only the form item and therefore you can give it a value only when the form is selected under the Forms Pane. If you do not know the syntax used, you can click the "Add Field" link and type the name of the question you would like to be part of the form description template.
...
- XForms Module
- XForms Module User Guide
- XForms Module Patient Registration
- XForms Module Form Designer
- XForms Module External Applications Guide
- XForms Module Technical Overview
- XReports Module ReportDesigner Technical Overview
- XForms Module Release Notes
- Download Module
- GitHub project (source code)
- XForms was discussed on a May 9th University call. Watch xforms video
- XForms Newbies FAQs