sts
1
Hey guys, I need some FEEL help: I have an array of objects, like
[
{"id": "id1", "data": "data1"},
{"id": "id2", "data": "data2"},
{"id": "id3", "data": "data3"}
]
What I would need is a corresponding list of strings like
["id1", "id2", "id3"]
Basically, [x.id for x in list] in Python. Or even better, a string, containing the ids like
"id1, id2, id3"
What is a good way to do that in FEEL / Camunda Modeller?
Best regards!
Niall
2
Sure thats easy enough.
If the varialbe is something like this
{"myData" : [
{"id": "id1", "data": "data1"},
{"id": "id2", "data": "data2"},
{"id": "id3", "data": "data3"}
]
}
Then you’d just need to use the expression myData.id
and it would return
[
"id1",
"id2",
"id3"
]
You can see how it works by checking out this example in the FEEL playground
If you want to return a single String value - it’s also quite easy. Just use this
string join (myData.id, ",")
And the return will be
"id1,id2,id3"
3 Likes
system
Closed
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.