Hello,
I have a repeat group that uses model iteration query. I would like to filter it basing on a single choice question selected prior to.
using [subcounty=/data/selected_subcounty] doesn’t work
any suggestions ?
Many thanks
Hello,
I have a repeat group that uses model iteration query. I would like to filter it basing on a single choice question selected prior to.
using [subcounty=/data/selected_subcounty] doesn’t work
any suggestions ?
Many thanks
Hey Leonard,
Thanks for posting this. My name is Shiv, and I am a CommCare Support Analyst at Dimagi. Based on my understanding, you can’t directly filter the items in the repeat group based on a form question (like a multiple-choice/single-select) in the Model Iteration Query itself. This is because the list of elements for model iteration must be a defined data set(cases, locations, lookup table items, or other data components that are known when the form is loaded). When the form loads, you can’t reference form data that hasn’t been collected yet in the query.
If you would be able to share more details about your use case here, I would be able to help you with a workaround.
Best,
Shiv
Hi Shiv.
This is quite the bottleneck in form design--I just faced something similar. Could this be modified in a way? While will can cut down the case list using direct filters on attributes, there comes a time where we need dynamic filters from previous questions (when an input from a previous question cause a change in the case list to be iterated).
Could it be a feature that can be considered sometime?
Thank you!
Hi,
Thanks for sharing your feedback. I can definitely see how dynamically filtering a model iteration based on answers collected earlier in the form would make certain form designs much simpler.
At the moment, this isn't supported because the model iteration query is evaluated using data available when the form is initialised, rather than values entered later in the form. So, dynamic filtering based on previous form questions isn't currently possible.
That said, your feedback is valuable to us. I'll pass your suggestion along to our Product team for consideration, or if you would like to share it separately, you can reach out to us at support@dimagi.com.
Best,
Shiv