Drop-down list of countries

Hi, Community

In the " [Foreign-born]" field of the WHO TB Tracker package: How to put a drop-down list of countries in this field.

Thank you for your support.


The best way i think is to create option set where you will include all the countires as options, then use this option set in you Data element, it will give you the dropdown list of countires.


Hi @elmoujarrade,

Please go to the data element named Foreign-born, and edit it to check if it has an option set associated with the field or not. (similar to the snapshot below):

if the value is empty, you need to add an option set and if the option set for countries is not predefined you can import it from the WHO TB Tracker package.

You can refer to this link for more details on how to import metadata: Import/Export App - DHIS2 Documentation I hope this answers your question :grinning:


Just to follow up these useful comments:

“Foreign born” in TB CS package is a tracked entity attribute, with an option set for Yes/No/Unknown.

The Common Metadata Library package includes an option set of 249 countries with their ISO 3166-1 alpha-2 country codes.

View option set on demo instance here

You can download the package and read more docs here.

Importing the package into your instance will allow you to add the GEN - Countries option set to any data element, or in this case, your Tracked Entity Attribute for “Foreign-born”.

Note that if you already have a values for this Tracked Entity Attribute with the previous Yes/No/Unknown option set, you will need to delete these in the database before you can update the option set to “Countries”.


A short addition to all previous comments.

The TB Case surveillance tracker includes metadata (minimal requirements) to help collect data required for eg. GTB.

One of the disaggregations is TB notifications among foreign born individuals.

Therefore we integrated the check in the enrolment stage.

If you would like to extend the data entry form and add the country of origin, I would recommend the following:

Keep the Dropdown foreign born as it is.

Then add an attribute suggested by @brian in the previous comment to the data entry form.
Then use program rules to assign the “home” country to the option set, if not foreign born.

If foreign born, the user will have to select the country from the drop-down list.

If Unknown, you can hide the option set and leave the value blank.

This is just a suggestion.
Hope that helps


Thank you for all these comments.

I want to apply your idea @YuryR. I will not modify the " [Foreign-born]" field with the Yes/No/Unknown option and I will add another field “Country” which will only appear if the answer is “yes” in the " [Foreign-born]" field .

Now; I just want to know how to import the “GEN - Country” option set on my Dhis2 instance.

Note that the WHO TB Tracker package does not include the “GEN - Country” option set.
Thank you for your support.

1 Like

Hi @elmoujarrade ! To import the attribute and the option set, I would suggest the following:

depending on the dhis2 version, you can download one of these packages:

The archive contains several files, you can import the tracker related file:

Once imported, go to Maintenance/program
select the TB Case Surveillance and add the tracked entity attribute “Country of residence” to the program tracked entity attributes.
It will then appear in the registration form

In order to create program rules based on the selected “foreign born” attribute, you will need to create an attribute program rule variable.

Hope that helps.


Thank you dear experts for your support.