Hi guys, this is a daft question but I can't for the life of me figure this out. I have an API response which I've indexed to retrieve the required data. If I output this indexed data, it's showing as the following format:
List of Variant (1 item)
List of Dictionary (3 items)
Dictionary
id 1 (Integer)
name "Alice" (Text)
id 2 (Integer)
name "Gail" (Text)
id 3 (Integer)
name "Kelly" (Text)
I'm trying to cast the above into a list of CDT, like so:
a!forEach( local!apiResponse, 'type!{urn:com:appian:types:test}Customer'( customerName: fv!item.name ) )
If I do that, instead of 3 Customer CDT's with a name in each, i.e.:
List of Customer - 3 items
I'm getting one Customer CDT with all 3 names as a list in the one customerName field i.e:
List of Customer - 1 item
I guess it's because I'm trying to perform the a!forEach on the single List of Variant, but how do I index into it to perform the forEach on the list of dictionaries within instead?
Thanks for any help!
Discussion posts and replies are publicly visible
This is one of the rare cases where the a!flatten() function can really help. docs.appian.com/.../fnc_array_a_flatten.html
That's brilliant, absolutely what I was looking for. I knew there'd be a simple solution, thank you so much!