Asking question for all unique pairings of select_multiple choices

Hi @paycemadden,

Welcome to ODK Forum, if you have a moment, feel free to introduce yourself here.

This is an interesting challenge you are trying to solve. Let's consider enumerator selects all four groups, following are the combinations that needs to be created:

Given that we can see

  • repeat_count of outer repeat = length of selected groups - 1 (in this case 3)
  • repeat_count of inner repeat = length of selected groups - position of outer repeat (in this case first 3, then 2 and then 1)

I have attached a working Form below.

Few suggestions:

  • When I have to design a complex Form like that, I like to be verbose by creating extra variables to keep my formulas simple. In the attached Form I have created selectedLength, index i and index j to help me understand the flow of the Form.
  • I use note type to see the values of calculated fields, once I am satisfied with the working of the Form, I change them to calculate to hide them.
  • Added a nested group in each repeat with relevancy so that when number of select group change, extra repeats are not shown: see this for more details.
  • We have XLSForm template that makes it easier to design Form, you can download it from https://xlsform.org/en/ref-table/

testform.xlsx (12.5 KB)

5 Likes