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.
Thanks for the clarification! The good news is that the issue is handled properly in the new app. We have created an entire category with documents and resources to help with the transition. Please feel free to make full use of it… Implementation - Implémentation > App Transition and Version Upgrades