Hi,
i would like to write a computation that collects / joins a list of fields together.
e.g.
{
"data": {
"mygroup": [
{
"aField": "value1"
},
{
"aField": "value2"
},
{
"aField": "value3"
}
]
}
}
computation joinAField should write “value1 , value2, value3” into aFieldJoined
(There is an additional requirement that duplicates should be ignored but let’s be realistic)
Is something like this possible with computations or planned?
Thanks
Julian
Hi @julian-typed-spruce
This is currently not possible and as far as I am aware there are no open requirements tickets to bring this functionality.
The background to this is limitation is that you cannot cerate Computation Cycles, in which you reference the same Field multiple times. In your context you want to reference aField multiple times to join all the possible values.
I know you only want to reference each index of aField once but this is where the limitations start, we don’t have a modelable syntax that says something like:
- append to last index
- join all indexes with
<StringValue>
That being said, we can do this in the UI. We can use an expression to join the repeatable fields and we can even specify a delimiter.
I used the following in these models to join the data in the UI. This solution is possible for Form and Overview Models as well as Print Models. Just search for the Expression documentation, for example Form Model - Expressions.
kontext(JoinFields){
kontext(MyGroup, delimiter = ", "){
[AField]
}
}
JoinFields_DM.json (1.7 KB)
JoinFields_FM.json (4.4 KB)

Thank you i will take a look into Print Models.