Note that use is limited to operations that don’t have a function as an argument, so the simple operations which accept arrays, objects, strings etc. as arguments can be used.
Examples of Lodash operations which can be used:
- \_.size - can be used to get a simple count on returned items (see Example 1 below)
- \_.split can be used to split a string of text, by specifying a separator
- \_.map for a list of results this can be used to group all the values together for a particular parameter (e.g. give me the **name** of every item from a list of results) (see Example 2 below)
- \_.uniqBy to remove duplicates from an array. See the [Useful scripts](/platform/useful-scripts/#removing-duplicate-objects-from-an-array-lodash) page for an example of using this to remove duplicate objects from an array, based on a particular field needing to be unique
Please check the Lodash documentation for simple operations which accept arrays, objects, strings etc. as arguments for more that can be used.
We will continue to add more examples of uses here!
Example 1 - using the _.size operation
The below example shows how you can use the Lodash _.size operation to get a total count on items output from another step.
In this case, we are counting the results returned from the Stripe List Customers operation:
From the debug output of a successful run you can see that the connector will return a simple count as a result:
Example 2 - using the _.map operation
The below example shows how you can use the Lodash _.map operation to group all the values together for a particular parameter.
The below example imagines that we have just used the List Helpers connector to combine two project task lists from Asana (as per the List Helpers example tutorial).
Now we want to use the Lodash _.map operation to obtain the name of each task:
From the step editor on the right you can see that we just have to specify the
$.steps.list-helpers-1.result and name as the parameter.
The debug output of a successful run will show you the result:
You will see that the result is to list the names of each task that is found in the combined list.