You can use a FLWR expression to iterate over your api response
1 Create your output variable of type "List of Any"
2 Your API response should be List of Orders
3 You will then use an assignment expression to map the response
for $patient in $output.Patient_List
If you are on IICS , pls. look at the artifacts attached
community_83472.zip 6.8 KB
1 of 1 people found this helpful
In ICRT, all the JSON gets converted into XML for parsing them. The expression(Xquery) works on the XMLs.
So your JSON would get converted into this:
<description>XR, ELBOW, 2 VIEW</description>
<description>INFUSION CENTER REFERRAL</description>
<description>CBC W/ AUTO DIFF</description>
Create a simple Process Object with 1 field and write the expression as below in the assignment step:
for $i in $OutputVariableName//orders
Please let me know if you have any further questions in this regard.
Thank you all for your help! I was able to get this to work with the expressions. Much appreciated! That example really helped.
Is there anyway to do this with a sub-process as well? If so, are there any examples out there?
An iteration over subprocess is usually used when you have to iterate over a specific object list where each iteration will call the subprocess and perform some activities, within it. The iteration will continue and execute subprocess until end of the list and then only invoke the step next to it in the parent process.
This case, it may not be a preferred approach as you aren't returning the output to the parent.
Another way you can get this to work is to "manually" iterate over the list, get the results for each iteration, store them in a master copy of the list and return it from the parent process. This is some overhead/slowness involved, like first creating a master list of output variables, then individually fetching the topmost record of the list that needs to be processed, passing it to the subprocess, fetching the results and storing it to the master list, remove from the processed record and repeat the cycle.
Considering your use case, best would be one of the two approaches as mentioned in the prev post above.