โ10-01-2024 01:47 PM
I have an Epicor BAQ with a list of Order Transactions that I use within a recipe that's working perfectly.
in a different recipe I want to see a list of Unique Order numbers on this report and didn't want to create a new BAQ
my thought was to execute the BAQ but only retrieve the 3 fields I need which will have lots of duplicates since every order can have multiple transactions.
was hoping there was some way to only show unique records when I execute the BAQ based on the 3 visible fields but don't see anything obvious... is there some combination of pluck and unique that works on a whole record as opposed to just one field in the record?
John
Solved! Go to Solution.
โ10-02-2024 09:33 AM
Got it. Here's the easiest way I can think of doing this:
Give this a shot and let me know if you get stuck.
โ10-01-2024 02:44 PM - edited โ10-01-2024 02:45 PM
This is definitely doable but it depends on what your end goal is.
If you just want a list of unique IDs, then pluck and uniq will work, like this:
orders = [{"id": 1}, {"id": 1}, {"id": 3}, {"id": 3}]
orders.pluck("id").uniq
## returns [1, 3]
This assumes you're determining uniqueness based on the ID only.
โ10-02-2024 06:22 AM
now this is probably a dumb question... not sure where I can add this formula... was thinking I could add it into the loop step but all it allows me to do is add the input list, I can't change to a formula field and do the pluck unique there so then was thinking I could create a list Batch and do it in that step but its not obvious
here s my recipe where Step 3 runs the BAQ and gives me lest say 20 records but only 3 unique records
I do the if to make sure its not empty and then loop through all the records... so it seems pretty straight forward just not sure how t insert this pluck unique before the loop step
โ10-02-2024 09:09 AM
Are you trying to loop through only the unique records?
What you're trying to accomplish is something Workato makes very difficult to do. I'm happy to explain how to do it, but I want to make sure I understand what you're trying to accomplish before I spend the time.
โ10-02-2024 09:10 AM
yes... I just want to loop through the unique records
where the record would be 2 fields Company and Sales Order number