I created 2 program rules in a tracker program to assign a 2 different value to a field according to the condition;
The first program rule condition is:
#{EMR_level_of_facility} ==‘DH’ and the action is asign the value A
The second program rule condition is
(#{EMR_SAM_Hospitalized} == ‘1’ && #{EMR_level_of_facility} == ‘DH’ ) || (#{EMR_SAM_Hospitalized_rg} == ‘1’ && #{EMR_level_of_facility} == ‘DH’) and the action is assign the value SAM
(#{EMR_SAM_Hospitalized} is a program rule variable on a data element with two options coded 1 and 0 same as {EMR_SAM_Hospitalized_rg}
#{EMR_level_of_facility} is a program rule variable on a data element with two options coded " PHC" and “DH”
Is checked use code for program rules.
the 2 programs rules function very well on the web version, but in the android version no matter the consdition it assign the value SAM
PS: on the first program i have also tried this condition :
(#{EMR_level_of_facility} ==‘DH’ && #{EMR_SAM_Hospitalized} == ’ ’ && #{EMR_SAM_Hospitalized_rg} == ’ ‘) || (#{EMR_level_of_facility} ==‘DH’ && #{EMR_SAM_Hospitalized} == ’ 0’ && #{EMR_SAM_Hospitalized_rg} == '0 ')
It woeks properly on web app but on the android it assigns the value SAM no matter what happens
#{EMR_level_of_facility} is a program rule variable on a data element with two options coded " PHC" and “DH”
(#{EMR_SAM_Hospitalized} is a program rule variable on a data element with two options coded 1 and 0 same as {EMR_SAM_Hospitalized_rg}
Thank you very much. I changed the program rule to this but no change from now. Do you have any advice?
(d2:hasValue(#{EMR_level_of_facility}) && #{EMR_level_of_facility} ==‘DH’ && !d2:hasValue(‘EMR_SAM_Hospitalized’) && !d2:hasValue(‘EMR_SAM_Hospitalized_rg’) &&!d2:hasValue(‘EMR_Clhiv’)) || (d2:hasValue(#{EMR_level_of_facility}) && #{EMR_level_of_facility} ==‘DH’ && #{EMR_SAM_Hospitalized}==‘0’ && #{EMR_SAM_Hospitalized_rg}==‘0’ &&#{EMR_Clhiv}==‘0’)