Hi,
we have requirement like we are calling one SP to get some data from DB. now we need to cast that SP response to one of the CDT.
we tried by casting some thing like
if( local!SPResponse.success,cast( typeof( { 'type!{urn:com:appian:types}<CDT Name>'() } ), local!SPResponse.result ), {} )
we are getting the results with target CDT having all the value are null. do we need to write any looping to assign individual elements or OOB casting will do for the same.
Please let us know if we are missing any thing for the same. if you can provide some sample it will be more help ful :)
Thanks in Advance.
Discussion posts and replies are publicly visible
try like this
if( local!SPResponse.success, 'type!{urn:com:appian:types}<CDT Name>'( id: index( local!SPResponse.result, "id", null ), xyz: index( local!SPResponse.result, "xyz", null ), abc: index( local!SPResponse.result, "abc", null ) ), {})
Thanks for the reply. its giving only one record. but my SP gave multiple Dictionary objects. i tried by looping but its not working. any thing more to add.
load( local!SPResponse, if( local!SPResponse.success, a!forEach( items: local!SPResponse.result, expression: 'type!{urn:com:appian:types}<CDT Name>'( id: index( fv!item, "id", null ), xyz: index( fv!item, "xyz", null ), abc: index( fv!item, "abc", null ) ) ), {} ))
with this we are getting only one record with targeted CDT. means data will be coming like
List of <CDT Name>: 1 item
<CDT Name>
id: 1;2;3;
xyz:"avc;xyz:aaa"
abc:"111;222;333"
all the data from the element is binding to target element with ";" separated.
Thanks.
is local!SPResponse.result dictionary ?
Casting as 'type!{urn:com:appian:types}<CDT Name>?list'() should do the trick.
Thanks!!!
Regards,
Hema