I'm working on an app where I want to select a different livestock feeds from two different lookup tables using multichoice questions and then use hidden values to retrieve data for labels and calculations with the name, energy content, and protein content of the respective feeds.
My reference for the lookup table in the hidden value is: if(#form/feedstuffs/feed/R1_select = ' ', 0, instance('item-list:BD_Roughage')/BD_Roughage_list/BD_Roughage[id = #form/feedstuffs/feed/R1_select]/roughage_name)
I'm unsure where this problem is coming from. Is it the hidden value reference or the multichoice question lookup itself?
Many thanks! It's currently working. I also had a problem within the hidden value for the ME expression but your suggestion helped identify the fix there too.
Previously, in setting out the lookup tables, I did try utilising repeat groups for a more robust approach but was stuck when it came to retrieving data from the separate lookup selections within the repeat groups. Is there a best way to go about this retrieval e.g. using current() or accessing by count /data/child_repeat[1]/name?
Coordinating references in between repeat groups is definitely a tricky thing to configure and will require using some advanced aspects of the system, as you've identified.
There's a Demo of this functionality that you can import into your app as an example to get a sense of how to plug those pieces together, it's probably the best place to start.