Program Rule conditions not evaluating

Hey Cha!
You are doing some pretty advanced expressions here, but it seems you got the syntax all correct. We are making better tools for syntax and integrity checking in the coming DHIS2 versions, I can imagine you had to do some counting to check that you got the right amount of parenthesis here :slight_smile:

From the warning in the console it seems that the value not getting populated into the expression is the #{f6a_pr_edd_final}. How is this variable configured? Is it linked to one of the data elements? And is this data element filled in? Perhaps you could make one more condition to avoid triggering the rule at all if #{f6a_pr_edd_final} does not have a value?

Markus

P.S. it would be great if you can post this as a topic on community.dhis2.org <http://community.dhis2.org/&gt; - and we can continue there.

···

2. nov. 2018 kl. 16:59 skrev Warancha Tumtaweetikul <wtum@bcchr.ca <mailto:wtum@bcchr.ca>>:

Hi Markus,

I’m having a problem getting a few program rules to work.

We have a long condition where:
(40-d2:weeksBetween(V{event_date},#{f6a_pr_edd_final}))>=16 && (40-d2:weeksBetween(V{event_date},#{f6a_pr_edd_final}))<=36 && ((40-d2:weeksBetween(V{event_date},#{f6a_pr_edd_final}))-#{f6a_pr_as_sfh})<=2

However, the console (please see image below) keeps on showing that the program rule variables are not getting evaluated even though those fields are populated and assigned the values from the other variables.
The second problem is we’re getting several “Could not perform background update of…” errors even though it seems the data has been saved to the database. We have several program rules to assign the value of one variable to three other variables (ex. Changing the date of a data element would change another data element with the new calculated date) in the order of its priority. I’ve tried deleting the program rule conditions one at a time, and the errors did disappear, and reappeared once I put the conditions back in. For example, this UiD: IH7Nnis3UMd is a data element, that gets assigned a value using program rule action by two program rules with different priorities. We’re trying to troubleshoot, but still have yet to figure out the solution.

Hope this makes sense!

Thank you.

Sincerely,
Cha

<image001.png>

1 Like