Including Lookup Table Information in the Form

Once we've defined a zscore lookup table, we need to reference it in our form. Edit the form XML and add an "instance" line that references the name of the table. You can place this above any existing instance tags in your form.

Calculating the Z-Score

In your form, first add three questions, one for the gender, age in months and measured weight. (You can also load these from a case if you've previously captured them elsewhere). Note-- your answer options for the gender question MUST be "female" and "male" (not "m", "f" or "1", "2") to align with what is written in the z score look up table.

Then add a hidden value (zscore) to calculate the approximate z-score from the table. The calculation for this hidden value should be:

Note: this calculation uses case properties named "gender", "weight", and "age." If you have named your case properties something else, you will need to change the reference above to the same name as your case properties.

This hidden value will be -3, -2, -1, or 0 which corresponds to the child being more than -3, -2 and -1 standard deviations from the mean. You can then use this hidden value for further calculations or display it back to the user.