Enrollment Errors in the Capture App when hiding TEA using Program Rules

Hello DHIS2 Community,

We have created a program rule to hide certain TEAs during enrollment. These TEAs should be visible when editing the profile after the first event is created.

However, we have encountered an issue when these TEAs are also used in other program rules to assign calculated values and later display text in feedback. It seems that hiding these TEAs is causing a bug—when the program rule is active, enrollments are not allowed. If we remove the program rule to hide the TEAs, the program functions correctly.

Has anyone experienced a similar issue, or could you provide guidance on resolving this? Any assistance would be greatly appreciated.

Thank you!

Hi @Henry_Lopez

Try to set priority for the PRs

1 Like

Hi @Ulanbek

Answering in Henry behalf (cause we are both working on this), we tried but it did not work. Apparently, the issues is related to the fact that some of the TEAs values are sent as null

Usually first I set the priority and check if the variable has value d2:has Value. And depending on that program rule will be executed.

I general I can’t say anything what exactly wrong unless see all the rules which you are referring to.

1 Like

Hi @Henry_Lopez and @Juan_Flamenco

Thank you for the info. It looks like there’s a conflict between the program rules at work (even if there’s a priority, it will not work if it’s expected to process the value before continuation).

If these program rules are at the enrollment level then you will need to ensure that they work when the TEA is null. As @Ulanbek suggested, use hasValue. For instance, if it doesn’t have a value which is what’s actually happening then assign it an initial value, or stop the action all together if it doesn’t have a value !d2:hasValue.

I agree, it will help a lot to understand the scenario as well as test the expressions all together.

Thanks! :+1:

Hello,

It is likely something like this issue?

https://dhis2.atlassian.net/browse/DHIS2-18621

Best,
Karoline

2 Likes

Yes @Karoline Seems to be the same issue, we addressed this bug by creating a custom enrollment

1 Like

Thanks @Karoline for sharing the Jira ticket. I’ve marked your post as solution so others can easily find the issue/solution.

Thanks for sharing @Henry_Lopez ! Would you like to share more about the custom enrollment?