Allows you to use custom logic to determine how to remove duplicates from a list.

To use this function, you’ll need a Child Flow that calculates the value that will determine if an item is unique or not. (For instance, you may have a list of available volunteers but you only want one person for each combination of job specialty and primary language). The child Flow you specify will get invoked once for each item in the list and return a value for each item. After all of the items are assigned values, a new list is constructed with only one item for each unique value.

Define fields on the event card that will be the inputs that are required to determine the unique value.  Typically you will include a field for the item of the list, i.e. if the list is a list of text then one of the inputs should be a string.  You can also include as other inputs whatever your Flow will need to calculate the sort value. If you need to know the position of the current item within the list, use the “Index” field from the Context section of the child Flow card. Then build the rest of the child Flow, ending with a Return card that returns a single value. The name for the value on the Return card doesn’t matter.  Save the Flow and turn it on.

Now go back to the Unique Custom card, input the list you want to remove duplicates from, and then select the Flow you just built.  The inputs will auto-populate, then you can map data into them.  To map an input to accept each item of the list, click in that field and you will see a dropdown that includes Item – select that.  Or if your list is a list of objects, you may also see the schema of the object, i.e. the keys that it contains, and  you can also build your child Flow to accept those as inputs.  In addition, you can drag in outputs from previous cards in the Flow – in that case, the same value will be used for each item in this list.

Input Fields

  • list: The input list that contains duplicates you want to remove
  • flow:  The child Flow that will be called once for each item in the list
  • with the following values (dynamically generated):  The inputs defined by the child Flow – these will populate after you select the child Flow using the Choose Flow dialog
  • concurrency:  The number of items in the list to process in parallel.  If it is important that the items are processed in sequence, use 1.  Otherwise a higher number like 5 or 10 will cause your Flow to complete sooner.

Output Fields

  • list: The output list that contains only one item for each unique value returned by the child Flow. The type of output list should be set to match the type of the input list (e.g. list of text or list of objects).

Example

  • You have a list of text: ["this","is","a","test"]
  • You create a child Flow that accepts a text input and returns the length of the text
  • For the text input to the child Flow, you click and choose “Item” from the dropdown
  • The output list will be: ["a","is","this"] – only one word of each length.