Can I use category to assign metadata attributes when importing data value through the api?

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:

  1. 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 attributeoptioncomboid field.

  2. 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.

Hi @jetisco4u

Thanks for sharing! It’s interesting how far you’ve gotten into using metadata in your apps. :+1:

I’d say for a custom app not to base it on a single dataset but rather for all probable datasets. :slight_smile:

I’m not sure exactly as it will also require a lot of testing and experimenting for me as well. However, one thing I could recommend is that your use case sounds similar to what could be implemented using program rules so what I can think of as a helpful approach to finding the answer if you don’t get a direct one is to create an example in a Tracker Program with the same functionality using program rules then see how the API treats that case in the API. Maybe? :smiley:

Hope this suggestion helps!

Thanks @Gassim for the suggestion. I have spent the past one week trying to see how I can use the Tracker program but there has not been any success. So I finally switch back to using Aggregate. With a supplemented node api and additional tables in the database, I have been able to combine the two system to fetch the data I need for my custom app the way I want. I am about to start working on the app itself. So I don’t have much to say for now until I implement the strategy. Meanwhile, in addition to capturing aggregate data during each event, we are also capturing different details of participants including signatures, array of images, date and many more data that is difficult to implement with the Tracker program.

Hi @jetisco4u! I wish you success with the app.

Please still feel free to make a post with the use case and features you were trying to make use of in the Tracker program. :+1: