cancel
Showing results for 
Search instead for 
Did you mean: 

get unique rows in lookup table column

rm135
Deputy Chef II
Deputy Chef II

say I have a lookup table with repeated entries in a particular column

e.g. 

property1

property1

property2

property3

 

how would I query the lookup table to return a list containing the 3 unique entries? 

 

1 ACCEPTED SOLUTION

gary1
Executive Chef III
Executive Chef III

Use the Lookup Table > Get all Entries action and this will return the entire lookup table.

Then use a Ruby formula to pluck and uniq the output. The structure of the LUT output is an array of objects each with a nested object containing the data, so you have to pluck the entry key, and then pluck the column with your property value. The result is an array on which you can call the uniq method to remove dupes.

 

[entries].pluck('entry').pluck('col1').uniq

 

 

View solution in original post

3 REPLIES 3

gary1
Executive Chef III
Executive Chef III

Use the Lookup Table > Get all Entries action and this will return the entire lookup table.

Then use a Ruby formula to pluck and uniq the output. The structure of the LUT output is an array of objects each with a nested object containing the data, so you have to pluck the entry key, and then pluck the column with your property value. The result is an array on which you can call the uniq method to remove dupes.

 

[entries].pluck('entry').pluck('col1').uniq

 

 

rm135
Deputy Chef II
Deputy Chef II

can you elaborate on the step to add that contains that formula? 

bharitha-jinka
Deputy Chef II
Deputy Chef II

Here is one more way to achieve this usecase. We can create variables and make a list. Then we can perform a query through SQL collection by workato. Through this solution, no need to perform iteration(for loop). Below is the recipe link, please go through it. Hope this will be helpful for you.

https://app.workato.com/recipes/47270819?st=48063075644985a1b4f82d3b287521ea3bf071c36ad1974f726553dc...