I need to survey a couple of variables about sowing and then ask more questions about garlic.
I created 2 repeating groups:
The first one asks for the varieties/species and the sowed surface
The second one must ask more specific details only on garlic varieties registered in the first one. To achieve this I used an indexed-repeat as explained in https://docs.getodk.org/form-operators-functions/#indexed-repeat to relate both groups and avoid repeating answers and empty ones (in the 2nd repeating group)
What I can't find out is how to filter everything except garlic varieties. I tried filters and starts-with() function in the relevant column without success.
I tried to create some context to better explain my thoughts, sorry in advance for any mistake
The choice list is like this:
Then I can use a relevant clause not(substr(${SelectedVariety},0,6)='garlic') but in order to do that I need to calculate this ${SelectedVariety} as we are looping on every selected option.
The calculation is selected-at(string(${Varieties}),position(..)-1) inside the repeat structure.
Is it possible to hide/show the whole RptSowingDetails repeat group (Sowing details) instead of just some questions? Where would you insert the calculate fields?
What you want are mirrored repeats. That is, in theory, all repeats have equal number of iterations (repeat_count), though, the user would only see relevant follow-up. To achieve this:
Create a template array (space delimited text) that holds the varieties of interest. ${garliVar} with calculation ("garlic_bogatyr garlic_brown_tempest garlic_calabrian_red garlic_chesnok_red garlic_french_pink")
in each follow-up repeat, add a group that will only show in the current repeat value of selected variety is a member of the ${garliVar} array using selected(${garlicVar}, ${garSelectedVariety}) as relevant
The are several benefits with this method: (1) ease of coding, no need to track indices of each repeat, (2) any change in main repeat is automatically reflected in follow-up repeats
Do you think it's possible to show only the selected garlic variety and hide the unselected ones when filling the sowing details? Or maybe hide the question as it's read only...