Programme rule only generates UIC after saving client – DHIS2 2.42

Hi everyone,

We’re using DHIS2 2.42 and have noticed an issue with our programme rules in the Capture app.

We have several Tracker programmes with rules that automatically generate a unique client identifier (UIC) by combining values from other tracked entity attributes in the registration form.

Previously, the UIC would populate as soon as all the relevant fields were completed, before saving the client. However, since upgrading to 2.42 and moving to the new Capture app, the UIC only generates after the client has been saved.

The rules are still working and generating the correct UIC, just not until after saving. All the fields involved are tracked entity attributes in the registration form.

This is causing an issue because we previously had the UIC set as mandatory. We’ve now had to remove that requirement, as otherwise users can’t save the client without a UIC, but the UIC won’t generate until they’ve saved the client!

Has anyone else experienced this? Is it a known issue with Capture 2.42, and is there a way to get the UIC to populate before saving again?

Thanks in advance for any help!

Hi @jschofieldwood

Is there a chance you are facing a similar issue as Carols and Mohammad in this topic: Program rule cascading issues.

If you are not using multiple program rules that rely on each other then let’s have a closer look at the program rule that generates the UIC. Would you share these points:

  1. PR Rule Expression
  2. PR Action definition and "Expression to evaluate and assign
  3. PR Variables (source type for each variable)
  4. PR Priority

One question that I have since you mentioned that this worked before the upgrade is whether this worked in Capture app or only the legacy Tracker Capture app?

FYI, if we can reproduce the issue on play.dhis2.org then we will be able to immediately triage to the team. :folded_hands:

Thank you!

Hi Gassim,

Thanks very much for your response!

I’ve looked at the other topic, but I don’t think it’s quite the same issue, as we’re not using multiple programme rules that depend on each other to generate the UIC. We have a single rule that combines values from four tracked entity attributes in the registration form.

Here’s the configuration of one of our rules:

1. Programme rule expression

d2:hasValue('REA- First two letters of mothers first name')
&& d2:hasValue('REA- First two letters of town of birth')
&& d2:hasValue('REA- CM- Month of birth')
&& d2:hasValue('REA- CM- Last 2 numbers of clients year of birth')

2. Programme rule action

Action: Assign value to tracked entity attribute REAct UIC

Expression to evaluate and assign:

d2:concatenate(
d2:left(A{REA- First two letters of mothers first name},2),
d2:left(A{REA- First two letters of town of birth},2),
d2:left(A{REA- CM- Month of birth},2),
d2:left(A{REA- CM- Last 2 numbers of clients year of birth},2)
)

3. Programme rule variables

All four variables have Tracked entity attribute as their source type.

4. Programme rule priority

No priority has been set.

Regarding your question about Capture, the rule worked in the legacy Tracker Capture app, but I’m also fairly sure it was working in the new Capture app when we initially upgraded to 2.42. I tested the programme rules as part of our upgrade testing, and I remember the UIC generating correctly before saving. The issue seems to have started shortly afterwards.

The rule still generates the correct UIC, but only after saving the client.

Happy to share screenshots or help reproduce the issue on play.dhis2.org if that would be useful.

Thanks again!