I have a special case for my data element. I wanted to capture a conditional data value. For example, let’s say I asked in my DE who head a facility. There are 3 options. If the user response is option 3, I want them to provide the designation of the person. If the response is option 1 or 2 the field to submit the response won’t show up. So I want to store the options response for the DE and the designation where DE is option 1 or 2. I am not sure how to implement this in my custom app. Here are possible options I think of:
Use categories to assign metadata attributes to all data recorded in the dataset (from the doc). I have about 200 DE in my dataset and only 16 of them have this use case which means the value will be blank for some DEs. If I follow this route can I set the attribute value when importing data value through the api? Like what will I include in the payload to assign the value to DE? I saw in the database table for datavalue that there is an
Create two DEs one for the options 1 to 3 answer and the other for the designation. If I follow this route I will be storing 2 different response for the DEs, in which case majority of the cases for designation will be empty. Besides, it will be difficult for me to implement fetching the two DEs as one for mapping.
Better still if I apply the designation as a category to the DE, can I store the two values in the same DE. Say I store an option value for the DE and store designation value for the category. That way I can pick the option value as aggregate say in an indicator. And use the category value if I need to see the designation value.