Hi Appian community,
Please could I get your help on a data issue with an integration I have made? For simplicity's sake, this is an expression rule and the results returned. I would like to use dot notation to index the text further but getting errors while doing so. Could you let me know what I am doing wrong?
rule!ESS_GetUnsettledTransactionList(ri!pagingInfo).result.body
returns the following:
Any Type (Text)
"{"transactions":[{"transId":"40030001593","submitTimeUTC":"2019-04-30T10:30:40Z","submitTimeLocal":"2019-04-30T03:30:40","transactionStatus":"capturedPendingSettlement","accountType":"Visa","accountNumber":"XXXX8888","settleAmount":412.97,"marketType":"eCommerce","product":"Card Not Present"},{"transId":"40030001333","submitTimeUTC":"2019-04-30T10:18:03Z","submitTimeLocal":"2019-04-30T03:18:03","transactionStatus":"capturedPendingSettlement","accountType":"Visa","accountNumber":"XXXX0027","settleAmount":412.97,"marketType":"eCommerce","product":"Card Not Present"}],"totalNumInResultSet":2,"messages":{"resultCode":"Ok","message":[{"code":"I00001","text":"Successful."}]}}"
As you can below, I would like to index transactions and also totalNumInResultSet. I am writing dot notation as follows and getting an error. Would you know why this is the case?
rule!ESS_GetUnsettledTransactionList(ri!pagingInfo).result.body.transactions - this should being be the transactions but it is throwing an error : "Expression evaluation error : Invalid index: Cannot index property 'transactions' of type Text into type Text"
rule!ESS_GetUnsettledTransactionList(ri!pagingInfo).result.body.totalNumInResultSet - is throwing an error "Expression evaluation error : Invalid index: Cannot index property 'totalNumInResultSet' of type Text into type Text"
Many thanks for reading this. Eric
Discussion posts and replies are publicly visible
Hi,
Seems your web-service is returning JSON string, please try to convert to Appian dictionary structure using a!fromJson
For JSON
a!fromJson( rule!ESS_GetUnsettledTransactionList(ri!pagingInfo).result.body)
Thanks
Vinay
Thank you, that has indeed done the trick!