Popular Help Content
No popular content.Page History
...
For example, you could use an IF statement to conditionally store a value in a a Hidden Value. Let's take an example where you register a client (a case) in a registration form and update the case property birth_facility. Later in the Follow Up form you want to update the case property birth_facility to the value of the question birth_facility_new IF the answer to change_facility is 'yes'; otherwise you want to leave it as the original value from the registration form. You would do the following:
- Make sure that in the registration form you update the case with the form data /data/save birth_facility In the follow up form create a hidden value called something like birth_facility_previous and leave it blankto the case
- In the follow up form create a second hidden value called birth_facility and enter an if statement in the "calculate" block: if(#form/data/change_facility = 'yes', #form/data/birth_facility_new, #case/data/birth_facility_previous)
- In the case management section of the follow up form settings, make sure to "load" /data/birth_facility_previous with the case property birth_facility (from the registration form)
- In the case management section of the follow up form settings, make sure to use the form data /data/birth_facility to update the case property birth_facility
For further guidance, please see the Hidden Values Tutorial Part 3: If Statements
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
If "And" Statement
You might have multiple conditions for an IF statement, where you need to use the OR or AND functions. Below are examples that demonstrate how you can write your expressions. Note that there is no need to enter IF twice for each argument.
- Example with AND: if(#form/data/sys_bp >= 120 and /data#form/sys_bp <=139, 1, 0) where 1 refers to high risk
If "Or" Statement
Example with OR: if((#form/data/gender = "male" and /data#form/waist_circumference > 90) or (/data#form/gender = "female" and /data#form/waist_circumference > 85), 1, 0) where 1 refers to a high risk
...
...
...