cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unable to create formula for length of list

JayMappus
Deputy Chef III
Deputy Chef III

Hi,

I'm trying to use the action step "Lists by Workato" but I'm having trouble populating the size of the list. I want the size to be a count of all unique "campaign" values. In a previous step in the recipe, a search result has a list datapill result like below (I'm showing just the first three results of many - showing 2 unique campaigns).  I was trying to use this formula  "(datapill).pluck("Campaign").uniq.length" to determine how many unique "Campaigns" there were as I would like the List to contain a list of unique campaigns. Can you tell me what I'm doing wrong?

{
Entities:
[
{
Campaign: Facebook California
City: Irvine,
},
(
Campaign: Facebook South Carolina,
City: Greenville,
},

(
Campaign: Facebook South Carolina,
City: Greenville,
},

.....

 

Thanks, 

 

2 ACCEPTED SOLUTIONS

gary1
Executive Chef III
Executive Chef III

You need to hover over it in the recipe data section -- the little mini drawer that appears in the middle/bottom of edit mode.

Basically find the "campaign" data pill (as if you were going to add it to a logger or something) and hover over it to see the API name. (I'm excited to see the API name, haha)

Are you getting an error on the pluck step?

I suggest breaking down the formula down into loggers to see what's happening:

  1. Make a logger with just the entities data pill to ensure it's passing correctly
  2. Once that's confirmed, make a couple other loggers with entities.pluck("campaign") and entities.pluck("Campaign") to see if either return data
  3. If either loggers in step 2 return data, then add .uniq to ensure that works
  4. Then add .length or .size
  5. Once it all works, consolidate it back into a single formula and add it back to the list helper

View solution in original post

JayMappus
Deputy Chef III
Deputy Chef III

Ah, now I see the "API Name"! And it is "Campaign__c". I made the change and followed your troubleshooting suggestions and it works for .pluck, .size and .length. I will use your "breaking down" technique again in the future I'm sure. Thanks once again, again for the help gary1 !

 

Screen Shot 2024-03-26 at 7.28.01 PM.png

 

 

View solution in original post

6 REPLIES 6

JayMappus
Deputy Chef III
Deputy Chef III

Ah, now I see the "API Name"! And it is "Campaign__c". I made the change and followed your troubleshooting suggestions and it works for .pluck, .size and .length. I will use your "breaking down" technique again in the future I'm sure. Thanks once again, again for the help gary1 !

 

Screen Shot 2024-03-26 at 7.28.01 PM.png

 

 

gary1
Executive Chef III
Executive Chef III

Glad it worked out. Gotta love the API name ๐Ÿคฃ