Android Capture app 2.4 - program rule showing option group for TEA does not work

Hi,

We have one program rule linked to a Tracked Entity Attribute, showing an option group for a selected set of diagnoses. It works fine on the web, but not in the Capture app 2.4. I have reviewed the relevant sections in the android docs, but cannot see anything specific related to TEAs and Program Rule differences.

The program rule expression is really simple, and returns a true as long as there is an enrollment date (i.e. it will always be true after a new case has been enrolled):
d2:hasValue(ā€˜enrollment_dateā€™)

The PR action is equally simple:
Show option group: ā€œNMC Diagnosis notifiedā€ on ā€œDisease/Condition/Event Notifiedā€

Are there known problems with using Show option group on TEAs? Any other reason for this failing?

Regards
Calle

@Pablo can you please advise here? I am not aware of any difference on this. I would have said that it might be related to this bug: [DHIS2-9854] - Jira but not sureā€¦

1 Like

Hi,
I had a look at 9854, where Zubair indicated that the problem related to the use of a date in the expression.
So we have now tried the following, but with the same result (option set is not filtered):

  • a d2:hasValue function using a text TEA instead of enrollmentdate
  • blank expression
  • expression 1==1, which is always true
  • and I also reduced the option group from 30 option values to 1, just in case there was something wrong with the option group.
    But none of the above resulted in the option group being shows - all works perfectly on the web, but not in Android.

Note also that we are using a different option group for the same option set in one of the stages, and that works fine - so it is thus clear that it works for data elements.

So it looks like this is an Android bug relating to the use of SHOW/HIDE option group for TEAs

Regards
Calle

Hi @Calle_Hedberg, I created the rule with the condition d2:hasValue(V{enrollment_date}) instead of d2:hasValue(ā€˜enrollment_dateā€™) and it worked.

1 Like

@nancyesp ,

As Iā€™ve indicated above, the problem is clearly not related to the form and shape of the expression since even 1==1 (always true) does not result in the drop-down being filtered on android.

But thanks for the heads up, that encapsulating the d2:hasValue argument in single quotes does not work for built-in variables. Just note that the Android documentation clearly states that both single quotes and the standard V or A or # encapsulation are supported, which then needs to be corrected.

Best regards
Calle

Hi @Calle_Hedberg . I made a simple test and I am afraid that there might be something wrong with your program rules. In the program displayed below I have created an attribute with an option set and three different groups. When changing the age the previous pregnancy outcome changes by showing different groups (please donā€™t mind the absurdity of the rules).

I see the same behavior in both web and Android as shown in the video. Also, note that when putting 30 (by the end of the video) I click directly on the attribute with the option group and this is still not updated. This is a common thing in Android that you need to exit the element that triggers the rule and this doesnā€™t happen when you jump straight from one to another but gets updated afterwards when I click on another attribute (not sure if that might be your problem?)

pr_attributes

An example of the Program Rules:


This has been tested on Android 2.4

Also, regarding the documentation, please remember that everything is available on github and despite we make all the efforts to have it updated it we sometimes fail at it or even have mistakes! So we very welcome any pull requests to fix it.

Thanks

2 Likes