Get values of a specific field within a repeatable group to a field outside the group

Hi A12 experts,

May I know if it’s possible to iterate over each instance of the repeatable group and retrieve the values of its fields, then save it all to another field outside the group?
I have a repeat group where Insurer is entered, I then need to get the list of all Insurers to show and input in another place outside of the group.

Thanks,
Huyen

Hi @huyen-gentle-brush,

We can achieve most of what you are asking for with modeling. I’ll give you some options and hopefully one of them matches your use-case.

Computation Rules
You can:

  1. Iterate over each instance of the repeatable group
  2. Concatenate String Data

You cannot:

  1. Reference the calculated Field in the Calculation
  2. Use the Sum(FieldList) with String Data (see here)

This means that to concatenate String Data in a Repeat, you have to use a horrible workaround which involves concatenating the current row data with the result from a previous row. This means that for a Repeat with “n” Repetitions, you need “n” Helper Fields in the Repeat. If you really need this result saved, I would recommend using a Custom Condition and implementing this concatenation with a developer.

If you don’t need the result saved, you can use an Expression

Expressions
The GroupOperation in the Expression language can be used to concatenate data with an optional delimiter:

kontext ( <group_name> [, delimiter = <delimiter_string>] ) { <list_of_elements> }

I added this to Person_FM in the Basic installer Workspace and it looks like this.


Person_DM.json (42.7 KB)
Person_FM.json (28.7 KB)

You visually get the results you want but the result is not saved. This means that you cannot search or filter for the concatenated result but this is often not necessary.

I would strongly recommend asking if the saved result is necessary and finding out if you can use the Expression.

Thank you very much for your detailed explanation.
I’m afraid that the result should be saved in my usecase because I need the Insurer list as input data for camunda task. I’ll try to find another solution or involve developer in as your suggestion.

Can you do the data handling in Camunda? I’m not an expert there and you would have to check their documentation, but could you use an expression in Camunda to get the data from the repeat and put it in the format you need?

Good hint!
I’m able to get the list of insurers as a json and then convert into a list via groovy script. Though it’s not BA friendly :wink: