How can I concatenate from a repeat into the parent?

431
2
Jump to solution
03-16-2022 05:18 PM
MichelleWilliamsERM
Occasional Contributor III

I have a related table, the child is a photo with a comment text field.

As an inspection is complete there might be 3 photos with 3 text fields populated, I'd like to concatenate all three comments into one answer into the parent. 

Instead of concat(value1, value2, …)

I'd like to concat(${repeat}) - I tried this and I only get the last comment

Does anyone have any ideas???

 

0 Kudos
1 Solution

Accepted Solutions
MichelleWilliamsERM
Occasional Contributor III

Thank you @jcarlson, the code you gave me didn't quite work in the new version of Connect, but I was able to find another version that did work; join(', ', ${PhotoComment}).    

I couldn't have found it without your help. I will use this all the time!!!

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

For concatenating strings in a repeat, try the join function. From the S123 docs:

Concatenates all answers to a given question in a repeat, separated by the given separator.

So you could use join(${photo_comment}, ', ') to get them all in one string of text.

- Josh Carlson
Kendall County GIS
MichelleWilliamsERM
Occasional Contributor III

Thank you @jcarlson, the code you gave me didn't quite work in the new version of Connect, but I was able to find another version that did work; join(', ', ${PhotoComment}).    

I couldn't have found it without your help. I will use this all the time!!!