Component: Tracker / Program Rules / Registration Form
DHIS2 Version: 2.39.8 (may affect other versions)
Description
When a Tracked Entity Instance (TEI) attribute uses an option set that contains multiple options with identical display names (but different UIDs and codes), the program rule engine incorrectly blanks the attribute value after a SHOWOPTIONGROUP action is applied.
Steps to Reproduce
Create an option set containing multiple options with the same display name but different UIDs and codes (e.g., âWard No-01â appearing multiple times across different administrative units)
Create a SHOWOPTIONGROUP program rule that filters this option set to a specific subset containing one of these duplicate-named options
Open a new TEI enrollment form
Trigger the SHOWOPTIONGROUP rule by setting the condition attribute
Select the option that has duplicate display names from the filtered dropdown
Expected Result
The selected option remains saved in the attribute field.
Actual Result
The field is blanked out with the alert: â[Attribute name] was blanked out because the option â[option display name]â got hidden by your last action.â
Root Cause (identified)
In dhis2.angular.services.js, the function clearAttributeValueForShowHideOptionActions identifies the selected option using:
var selectedOption = optionSet.options.find(function(o) {
return o.displayName === value
});
When duplicate display names exist, this find returns the first matching option in the option set array, which may have a different UID than the one included in the SHOWOPTIONGROUP option group. The subsequent visibility check:
I have a question please, how does the data entry end user know which âWard No-01â is which when theyâre all duplicates?
I canât think of a use-case when display name needs to be duplicate because I canât answer the question to how the datamentry user will be able to differentiate which specific option theyâre selecting. For example, they see the option âWard No-01â and âWard No-01â how do they know which one is âZone Aâ and which one is âZone Bâ?
It appears that you are using an older version of DHIS2 as well as the deprecated Tracker Capture legacy app. Itâs recommended to use the latest supported versions of DHIS2 as well as the Capture app (instead of the Tracker Capture app).
This is handled in a much better and improved way in the newer versions. Is there a reason why youâve not upgraded? Itâs possible to actually start by testing in a test environment before upgrading to get an idea why itâs important to upgrade and experience the improved performance, security, and features.
This is a good question. Think of it as dependent dropdowns of location hierarchy where multiple city corporations have âZone-1â. The data entry operator selects the city corporation first, then moves to select the zone from the next dropdown.
We are in the process to move to the capture app. But it needs to re-train the operators accross the country (including public and private sectors). As we have one of the largest national level DHIS2 deployments in the world, it is taking time.