Forum Discussion

DwightMunson1's avatar
Qrew Assistant Captain
6 months ago

Pipelines: Search Records, Get List of Unique Values Question

Hello! I have a pipeline that has been made better over time but isn't the most efficient thing. 

We have an hourly invoice. We add timecard to the invoice. However, one company wants some summary data we can only get by creating a record in a summary table.

So the current pipeline: 
A. Timecards are added to an hourly invoice, and we have a checkbox to trigger the pipeline. 
B. The pipeline prepares a bulk record upsert to relate the timecards to the summary table.
C. The pipeline searches for all the related timecards. 
For each timecard (loop):
D. Add an upsert row to related the timecards to the summary table.
E. Look up a record in the summary table, to see if it already exists. 
Condition: If not exists then F. Create it
Out of loop. G Commit upsert to relate the timcards to the summary table records. 

What I would like to do is when I search the timecards initially I would like to get a list of the unique values for the summary table. Then use those unique values to search the summary table records to see if they exist, and if not create them. 

The way it's set now, while it's looping sometime a summary record gets created, then when another loops it tries to create it again, but it was aleady created. We're talking about hundreds of timecards. 

Can anyone think of how to search the timecards and return a list of unique values? 

Or just a better process? I'm open to any ideas.

Dwight Munson
No RepliesBe the first to reply