however we are having trouble on how we can properly handle/translate the response especially on the listPolicyNumber.policyNumber the sample list shows only 2 items but it can be more than 2.
On your output contract, for an array, you need to add an entry for what type of values are going to be in the array, so in this case it looks like you should add a string type inside of the listPolicyNumber array.
If that doesn't get things working for you, please post the output from the "execute" step of test mode. That will show us the response before your output is flattened.
what I want to achieve is get all the results of listPolicyNumber.policyNumber into 1 Output separated by comma ( , ) or bar ( | ), in that way I would be able to make a list variable in architect and count the returned values. or is it possible to count the policyNumber on the translation map? because
listing all possible returned policy number in different output could be tedious to do and maintain if there is > 10 return policyNumber. Hope that I'm making sense and you will be able to help me.
You can get a string array of the policy numbers with a templateMap entry like this: listPolicyNumber[*].policyNumber
You should be able to return in our output contract as an array with string items in it. Architect will handle that as a string array, which should be easy to deal with.
thanks and yes I did able to handle it in architect. but I have a problem when the outputs are passed to another flow. in the origin flow the data action response is a collections, then I put that collection to a Set participant Data so I can pass it to another flow. upon transferring to another flow I used Get participant Data to get the output however in 2nd flow it's no longer a collection.
for example:
in 1st flow I invoke the data action and this is the result (from execute steps), when I used Count function something like ToString(Count(Task.ListPolicyNumber)) the result = 5
{
"listPolicyNumber": [
{
"policyNumber": "11111111"
},
{
"policyNumber": "22222222"
},
{
"policyNumber": "33333333"
},
{
"policyNumber": "44444444"
},
{
"policyNumber": "55555555"
then I store this data action output to a Set Participant data this is the value: 11111111 22222222 33333333 44444444 55555555
transfer to another flow and use Get Participant Data value same: 11111111 22222222 33333333 44444444 55555555
but when I run ToString(Count(Task.ListPolicyNumber)) = 1 what should I do?
I also need to play any of the selected item within the collection, example in architect I will create a menu something like: We were able to get 5 policy under your name please select what policy you want...
if caller press 3, I should be able to get the 3rd item in the collections.
I would suggest asking your Architect specific questions in the Architect room. And/or you could open a support case if it appears to be acting incorrectly.