Survey123 populates table with selected values

528
8
Jump to solution
07-28-2020 12:37 PM
by Anonymous User
Not applicable

Hi all,

I'm building a survey with a repeat in it. When specific criteria is met (in this case "female"), Survey 123 adds all the females to a list below the repeat (note field or table).

If male is selected, then the table or note is not updated with the name.

I'm not sure how to do this with the correct syntax and how to display multiple names Dynamically - when the female selection is selected. Please help.

See attached example survey.

Thanks,

Paul

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Notable Contributor

Join only takes one argument join(separator, question).  So try join("\n",${name}).  If you search the board I think this was posted not too long ago.  Not sure what the outcome was.

Formulas—Survey123 for ArcGIS | Documentation 

Sorry I am not more help

View solution in original post

8 Replies
Jim-Moore
Esri Regular Contributor

Hi Paul

You can concatenate all answers for a question in a repeat using the join() function. Apologies if I've missed the objective here, but one way you might achieve this is to have a hidden question in the repeat that stores the name if 'female' is selected, using a calculation similar to: if(selected(${gender},'female'),${name},''). Then use the join() function outside of the repeat to concatenate the values for that question. Please see simple example attached.


For more info on functions, please see Formulas—Survey123 for ArcGIS | Documentation.

Hope this is of use!

Best,

Jim

0 Kudos
by Anonymous User
Not applicable

Thanks Jim that works however, the names are not returned in a separate line. Is there a way to insert a carriage return in the code so each name is listed vertically? (when I have long names, they are spread across multiple lines.)

Thanks,

Paul

0 Kudos
by Anonymous User
Not applicable

Correction - not vertically but horizontally in its own line.

0 Kudos
DougBrowning
MVP Notable Contributor

I think someone posted that you can add a \n?

0 Kudos
by Anonymous User
Not applicable

To confirm, this is done in the calculation field with the join, like this:

join(',',${name},"\n")

I understand the appearance must be set to multi-line, however this is not creating a new line in the form with the names on separate lines. (I'm just looking for the correct syntax).

Thanks,

Paul

0 Kudos
DougBrowning
MVP Notable Contributor

Join only takes one argument join(separator, question).  So try join("\n",${name}).  If you search the board I think this was posted not too long ago.  Not sure what the outcome was.

Formulas—Survey123 for ArcGIS | Documentation 

Sorry I am not more help

Jim-Moore
Esri Regular Contributor

As Doug suggests, "\n" should work in the field app. You might also want to try "<br>" as this should work in both the field app and the web app.

0 Kudos
by Anonymous User
Not applicable

Thanks for your help Doug, it works with this: join("\n",${name})

0 Kudos