Urgent Help Needed: Using d2:condition in a program rule to calculate a set of values

Hi @Markus. Here is my feedback.

  1. Using d2:condition(’#{ovc_ra_hiv_active_sex}==“Yes”’,1,0) : This one did not work. I got the error like:

Original condition was: d2:condition(‘#{ovc_ra_hiv_active_sex}==“Yes”’,1,0) - Evaluation ended up as:d2:condition(‘‘Yes’==“Yes”’,1,0) - error message:SyntaxError: missing )

I doubt whether the double quote can work here or not. Kindly correct if I have done anything wrong.

  1. Using Calculate Values: I tried this for 2 of my data elements and it worked. :slight_smile: I guess this could work for me. But the challange is I have 10 data elements to check. This means I should create 10 variables, define 20 rules (one to assign 1 for YES and another one to assign 0 for NO). This approach is not only tedious and timeconsuming but also adds more maintenance work for future changes. If the d2:condition function works, I will be doing a better job. Kindly see, if you can assist with d2:condition error message.

Otherwise, many thanks for sharing your knowledge and experience with me. That is wonderful :pray:

1 Like