Enunciating all household members from a list in a text

Hello, I want to know how could I repeat the information given on a list question, in a text. The goal is to confirm all the household members given on the list. For that purpose, I am considering the following steps:

  1. Firstly, I intend to store the household members in a string variable, but the following code is not working.
    string_variable = l_.personas.All(x=>x.Item2).

  2. I want to use the information stored in the string variable, expressed as “The household members are %string_variable%”. I know that I have to refer to the string variable as %string_variable%. The problem is coding the string variable itself.

Can anyone help me with this?

Thank you!

Hi,

  1. Check the variable name of your list question. If it is indeed called l_.personas, it will return compilation error WB0122.
  2. Once you use a correct name, e.g. personas_list, you could use the following expression at your variable of type string (named string_variable) to join the various list items:

String.Join(", ", personas_list.Select(x=>x.Item2))

You can replace the first part ", " with any character(s) (including whitespace etc.) to determine the delimiter to separate each item.

2 Likes

It is probably a good idea to also set the checkbox ‘Do not export’ for this variable, as the value is going to be quite large, and not anything particularly useful in the export, since it is generated from the data that is already stored elsewhere, and is thus redundant.

3 Likes

It worked perfectly, thank you!

1 Like