How to create cascaded options

want to create cascaded choice field.

for example, filed A and filed B.
in filed A, there is option A, B, C
in filed B, there is option A01, A02, B01, B02, C01,C02

when choose A, and filed B, only show A01, A02
when choose B, and field B, only show B01, B02

1 Like

Hi @nanwang
You can use option groups and program rules to achieve this.
Create option sets as follows:
Option set 1 with options A and B
Option set 2 with Options A01, A02, B01, B02, C01,C02.

Assign to DEs to TEAs accordingly.

Create option groups:
A to consist of A01, A02
B to consist of B01, B02 etc.

Then create program rule variables and program rules e.g to show only the class of As:
Expression: if value (i.e. program_rule_variable) == ‚ÄėA‚Äô
Action: Hide option group B

1 Like

Just wondering if i do have 100 districts, 500 counties, 2000 subcounties, 5000 villages. That means creating 2600 (2000 for subcountie+500 for the counties+100 for the districts) programe rules to cater for these cascades. I Vote for/suggest we incorporate program rules that use custom code (SQL, JQuery, JavaScript) to deal with options of this nature into DHIS2.

1 Like