Hello!
I’ve been stuck with finding a solution for my automation using persistent activities and would appreciate any suggestions!
Context:
I have a process in which I have a dynamic number of PDF files. For each file, I want to start a job that runs Document Understanding on the file and returns a DataTable of the results. After all jobs have finished, I want to combine all the returned DataTables into a single DataTable.
The Problem
The part I’m having trouble with is saving the returned DataTables. I’ve tried doing this a few different ways, but haven’t had any luck.
Here’s what I’ve tried:
I used a for each loop over the files in the directory. Within this loop is a Start Job and Get Reference
activity from the Persistence
UiPath package. This job has two arguments, in_FilePath
and out_DataTable
. Also within the loop, the JobObject is added to a collection (for all the jobs). After this loop is another for each loop for all the jobs within the JobObject collection. Within this loop is just the Wait for job and resume
activity (i.e. waits until the given job is finished, moves to the next that may already be fininshed so it continues moving).
Again, the trouble I’m having is figuring out how to save all the out arguments. I’ve tried creating a variable ListDT = List<DataTable>
and a counter variable that is incremented for every iteration. When a job is called, the out_DataTable
is set to ListDT(Counter)
with the idea that each DataTable is saved in its own index. But ListDT is never populated. I’ve also tried this same method but by initializing the index with a new DataTable first. I thought about using a parallel for each loop instead and having both job starting and waiting activities, but I’m not sure how to save the argument still.
Does anyone have an idea of how I might go about this?
Thanks!