In a tracker program, I have one repeatable stage that is configured as follow:
Data element 1: Participant attendance that has an option set attached to it. The options in the option set are: (Session 1, Session 2, Session 3, Session 4, Session 5, Session 6, Session 7 and Session 8).
Data element 2: Attended, which is Yes/No DE
Data element 3: Received, which is also a Yes/No DE
I want to get the following result from the program rule:
If Participant attendance is Session 3 and Attended is No or If Participant attendance is Session 6 and Attended is No, then Show DE Received Cartao Quero.
This is the rule I created in the DHIS 2, but it is not working.
Thanks @dmbantu! It doesnât seem like thereâs any syntax issue and the logic makes perfect since. I will write a couple of suggestions by priority and hope that we will be able to find the solution. Please first use the browser cache cleaner app to clean all the cache, and Iâd also use the data administration app > Maintenance to âclear application cacheâ and âreload appsâ.
If itâs not then please test with the rule you created. Would you like to try and see if each one of these conditions work on itâs own. We want to understand the issue so what I mean is if you test first !d2:hasValue( #{Participant attendance} ) and see if it hides the field
if it does then try the second one (#{Participant attendance} != âSession 3â &&#{Attended} == false)
and then (#{Participant attendance} != âSession 6â && #{Attended} == false)
If none of the conditions work separately then maybe use the program rule condition as it is, and then weâll definitely have to check the logs to know whatâs the issue.
It might be that the boolean values are stored as numbers in the database to make calculations faster. According to the user guide on Boolean fields, Yes is translated to numeric 1, No to numeric 0.
I havenât tested it myself but it is worth a try.
Thanks @dmbantu for testing it out! And thank you @Paul for your suggestion, and I hope it works; however, if it doesnât then we also need to know how come
doesnât work? And my other question @dmbantu does #{Attended} == false work? [it shouldnât if itâs value is 0/1]
Did you try maybe moving !d2 to the end? (#{Participant attendance} != 'Session 3') || (#{Participant attendance} != 'Session 6') || !d2:hasValue( #{Participant attendance})
And⌠if all work separately, how about creating a separate program rule for each condition?!