Hi Gracie,
The workflow you have shown in the READ-CSV part seems bit off to me as you are reading the CSV file into a collection then looping through each row, adding the data into the work queue which will return you the Item ID for the added item at that instance only
and then you are again looping through the Item ID's and then using Get Next Item action which will return you the same Item ID and then marking it as complete.
The issue is with the highlighted part that you can see, the reason being if you directly use Item ID you will always get the current item which is in the queue at that point of time and you are again trying to mark it as complete without doing any processing at all.
The right approach should be to first load all the row items into the work queue one by one which can be done either in a separate process altogether or maybe as a part of the same process before fetching the items from the queue at that time. And you should only mark items as completed if you have completed processing on it end to end.
In my workflow above I am reading the input file first in the first called page, then launching the application in the second page and in the third page I am loading the collection items from the CSV file into the work queue which you can see below:
So here I am basically looping over each row of the collection from CSV file, then checking if any duplicates were there or not (optional step). If no duplicates found, I set the value of my current row to a pre built collection called queue data having a single row and all the columns as mentioned in the CSV file form the beginning only and then I add a tag (which is again optional) and then add the item to the queue. At the end of the execution of this page, I am supposed to get all my items from the CSV file into the work queue with status as Pending.
Now once I have my queue set up, now I use 'Get Next Item' action which will return me the 'Item ID' data item if it exists, if not it will return me null which means I need to stop my process as we don't have any transaction to work on, so I check both the conditions as well as shown below:
If the item is present then, I would get a single row data item for my current item which has been picked up and I can process it accordingly for now post which I will be marking the item as either completed or exception depending on the execution result.
Once item is processed, we reset the error variables so that they dont get carry forwarded in the next transaction if they occurred currently and then we check if the user requested to stop the process from Control room or not, if no we go ahead with using the 'Get Next Item' action again checking if we received any item ID or not. This would ensure that we keep on processing all the items one after another till none is left.
This way you should be trying to iterate through the collection items in a queue, one at a time. Let us know if this helps you out and please mark the answer as the 'Best Answer' if it resolves your query so that others can track the answer easily 🙂
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.