Hi! I have a question that seems like it should be super simple, but is taking forever for me to figure out.
I have three select one question in a survey123 connect XLSForm. I need to create an expression that summarizes these responses across multiple repeats in a string outside of the repeat. Basically I want the user to be able to quickly read what data has been collected in that repeat.
The question/item names are speciesCount, speciesCondition, and Species.
For example, I need to accumulate the results 3 repeat responses. I want it to look like this:
{speciesCount1} {speciesCondition1} {Species1}, {speciesCount2} {speciesCondition2} {Species2}, {speciesCount3} {speciesCondition3} {Species3}
or
7 Alive Spruce, 9 Dead Aspen, 2 Alive Birch
This expression:
concat(${speciesCount}, " ", ${speciesCondition}, " ", ${Species})
puts the data in the right order but erases data when you add a new repeat.
This expression:
join(", ",${speciesCount}, " ", ${speciesCondition}, " ", ${Species})
Accumulates data throughout repeats but it is not in the right order and looks like this:
7,9 ,2, ,Alive,dead,Alive, ,Spruce, Aspen, Birch
${speciesCount1) ,${speciesCount2) , ${speciesCount3), ${speciesCond1},${speciesCond2}, ${speciesCond3}, ${baSpec1}, ${baSpec2}, ${baSpec3}.
I then tried to create a hidden row to accumulate data, then another calculate row to display, and another row to see if text display would change anything. This generates an error 'dependency cycles amongst the xpath expression in relevant/calculate\n\nResult: Invalid' or it cycles forever and never updates the form.
Hopefully I explained this well but please let me know if I can elaborate more. Any tips or ideas on other ways I could achieve a summary field would be super appreciated. Thank you!!
Solved! Go to Solution.
This will:
You can adjust the concatenated text or join separator as desired.
This will:
You can adjust the concatenated text or join separator as desired.
Christopher thank you!!
This worked perfectly.