Android Capture App Programme Rules

Dear DCOP,

We are using DHIS2 v2.41 and Android App v3.0.1, the program rule: d2:hasValue( A{ENR_DOB} ) && d2:yearsBetween( A{ENR_DOB}, V{enrollment_date} ) <= 9 Action: Show error on tracked entity attribute. is not working on the Android Capture app but it’s working just fine on the web. I have read through mulptiple documentation where the new android suported rules are discussed but can’t pick anything related to this. Any suggestions of what could be making the rule not to work?

Hi @WaluQ !

Thank you for the report. Is it possible to provide more detail? I was not able to replicate the issue.

This is the way I configured based on your post:

  1. VARIABLE
    image

  2. RULE CONDITION

  3. RULE ACTION
    image

image

1 Like

Hi @nancyesp,

Thank you for the response. Basically that’s all that I am doing with an adition that apart from showing the Showing Error, the rule is supposed to hide one other field (the field is only mandatory when a valid DOB is provided), but this is not happening. There is this hint that the expression valiting encoutered a problem, but can’t seem to point why the expression can evaluate to either valid or invalid.

The program rule expression validation also remains showing Checking expression status... and does not evaluate. Is there a way to identify what could be causing these issues.

It is a bit strange. Could you check if the variables have the correct attributes? I’ve seen cases where the variable is created but somehow its gets cleared out. Try to clean cache and then open the variable just to see if it is well configured.

image

1 Like

Thank you Nancy, for some reason the show error action is now showing but only the hide attribute action is stil working but I think I can work with this. And the failing evaluation was actualy being caused by a different program rule variable that didnt have the actual data element assigned. It’s strange that DHIS2 allows saving program rule variables without specifying data elements they point to. :thinking: