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.
@ChristopherCounsell I am trying to repeat this workflow and cannot get it to work. I did have a join working when I originally completed my form, but it has been broken for at least 6 months. I am not sure if there was an update that caused it to break or what.
I have confirmed that my concatenate calculation works, and believe it is something in step 2 above, as when I unhide the Phase_summary field (see snapshot) nothing appears - it is just an editable box.
Do you have any suggestions of where I am going wrong? Thanks in advance.
I would recommend making a new post and providing your XLSForm. Unanswered posts get more attention. Feel free to tag me or other MVPs.
Your circumstances sound different. Notably the formatting and you're using the web app. Can't provide any insight without the xlsform to be honest.