Jump to a Section
  • Add to End

    Add an item to the end of a list (aka Push).

    This function can operate on lists of any type. To ensure this works correctly, you should make sure that all 3 fields are set to the same type, i.e. if you want to process a list of text, set both list fields to be a list of text and set the item input to be type text.

    Input Fields

    • list: the input list
    • item: the item to add

    Output Fields

    • list: a new list which is the input list with item added to the end.
  • Add to Front

    Add an item to the start of a list (aka Unshift).

    Input Fields

    • list: The starting list. Be sure to set the type of the list (e.g. list of objects or list of numbers)
    • item: The item to add to the front. (Be sure to set the type – e.g. if the input list is a list of numbers, then item should also be set to be a number.)

    Output Fields

    • list: Returns a new list with the added item at the front. (Be sure to set the type of the output list to match that of the input list.)
  • At

    Returns the item at the specified position in a list, where the first item is in position 0.

    Input Fields

    • list (list): a list of items
    • index (number): the position of the item you want to select. In a list, the first item is always located at index 0, the second at index 1, the third at index 2, and so on.

    Output Fields

    • item: the item from the specified position of the list. Item needs to be the same type as list (i.e. if you have a list of numbers, then item should be set to be a number.)

    Examples:

    • If list is ["one","two","three","four"] and index is 0, then item is "one"
    • If list is [1,2,3,4,5] and index is 2, then item is 3
  • Collapse

    Collapse a list of objects into a single object by merging each object in the order they appear in the list. If objects have overlapping keys subsequent values will take precedence over preceding values.

    Examples:

    Input list Output object
    [{“item”:1},{“item”:2}] {“item”:2}
    [{“valueA”:“a”},{“valueB”:“b”}] {“valueA”:“a”,“valueB”:“b”}

    Input Fields

    • list (required) - the list of objects that you want to collapse

    Output Fields

    • output - the collapsed object
  • Construct

    Constructs a new list from a set of values.

    To use this card, you must create correctly-named inputs and set your types correctly.  First, decide what you want a list of - text, numbers, objects, etc.  Set the type of the list output accordingly.  Then for each item, set the type of each input.  Once you’ve created all your inputs, drag or type in the values for each item.

    Input Fields

    • (user created fields)

    Output Fields

    • list: the new list
  • Difference

    Removes any items in a list (list1) which are also in the second list (list2).  The output is a new list which is a subset of list1, containing only those items which are not in list2.  The lists can be a list of any type of item - a list of text, a list of numbers, a list of objects, etc.  All 3 lists should be set to the same type.

    Input Fields

    • list1 (list of *) - required: the list to filter.
    • list2 (list of *) - required: the list of items to remove from list1.
    • you can optionally add additional lists to filter from list1

    Output Fields

    • list (list of *): the output list

    Example

    list1: ["andrew", "beth", "carla", "david", "elwood"]

    list2: ["beth", "david", "frank", "gina" ]

    output list: ["andrew", "carla", "elwood" ]

  • Filter

    Filter a list to include only those items that meet a specified condition. (To filter based on more complex criteria, use Filter Custom)

    Input Fields

    • list: the list to start with
    • operator: what comparison to make (see table below)
    • path: leave blank when filtering a list of text, numbers, or date/time. When filtering a list of objects, _path_ is the name of the key that holds the value you want to compare. Use a period to specify a path to an object inside another object (e.g. “customer.id”).
    • comparison: the value to compare against

    IMPORTANT: Be sure to set the type of the input list and comparison to reflect how you would like the comparison to be done. For instance, the operator “greater than” compares numbers based on numeric value but text based on alphabetical sort order. So the number comparison 80 > 9 is true, but the text comparison “80” > “9” is false.

    Output Fields

    • list: the new list that contains only those items where the condition was met.

    Table of Relational Operators

    Operator Use Case
    equal to Compare two texts, numbers, dates or true/false to see if they have the same value
    not equal to Compare two texts, numbers, dates or true/false to see if they have different values
    greater than or equal Compare two texts, numbers or dates to see if the first has the same or greater value than the second.
    less than or equal Compare two texts, numbers or dates to see if the first has the same or lesser value than the second.
    greater than Compare two texts, numbers or dates to see if the first has a greater value than the second.
    less than Compare two texts, numbers or dates to see if the first has a lesser value than the second.
    a multiple of Compare two numbers to see if items in the list are an exact multiple of the comparison. (e.g. 12, 0 and -4 are all multiples of 4, but 2, 3 and 7 are not.)
    in Compare two texts to see if items in the list are part of the comparison. (e.g. “test” is in “this is a test”, but there is no “i” in “team”)
    not in Compare two texts to see if items in the list are not part of the comparison.
    has key When an item in the list is an object and the comparison is text, tests to see if the object has a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “order_num”). Path only required when searching for a nested key.
    doesn’t have key When an item in the list is an object and the comparison is text, tests to see if the object does not have a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “name”). Path only required when searching for a nested key.
    is empty Checks to see if an item on the list is empty; ignores the comparison. What defines “empty” varies by type. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).
    is not empty Checks to see if item on a list is not empty. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).

    Examples

    If the input list is [1,2,3,4,5,6] and operator is “greater than”, path is left blank, and comparison is 3, then the result is the list of numbers greater than 3, which is [4,5,6].

    If the input list is [{"name":"Bob","gender":"male"}, {"name":"Sarah","gender":"female"}] and operator is “equal to”, path is “gender”, and comparison is “female”, then the result is the list of objects where gender is female, which is [{"name":"Sarah","gender":"female"}].

  • Filter Custom

    Given a list, the Filter Custom function creates a new list that contains only those items in the list that pass a test. The test is done by calling a child Flow once for each item. The Flow returns true or false, as to whether that item should be included in the output list. (To filter using a simple comparison test, use the Filter function instead.)

    To use this function, first build the child Flow that you will use to test each item.  This child Flow will be invoked once for each item in the list. Define fields on the event card that will be the inputs that feed into the test. 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 text.  You can also include other inputs, whatever your Flow will need to perform the test.  Then build the rest of the child Flow, ending with a Return card that returns a single value of the true/false type – either True (to include that item in the resulting list) or False (to not include it). The name of the true/false field on the Return card doesn’t matter.  Save the Flow and turn it on.

    Now go back to the Filter Custom card and 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 all of the items you will test
    • 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 those items that passed the test, as determined by the provided child Flow.
  • Find

    Find the first item in a list that meets a specified condition. (To find based on more complex criteria, use Find Custom)

    Input Fields

    • list (list of objects): the list to start with
    • operator (drop down menu): what comparison to make (see table below)
    • path (text): leave blank when searching within a list of text, numbers, or date/time. When searching within a list of objects, _path_ is the name of the key that holds the value you want to compare. Use a period to specify a path to an object inside another object (e.g. “customer.id”).
    • comparison: the value to compare against

    IMPORTANT: Be sure to set the type of the input list and comparison to reflect how you would like the comparison to be done. For instance, the operator “greater than” compares numbers based on numeric value but text based on alphabetical sort order. So the number comparison 80 > 9 is true, but the text comparison “80” > “9” is false.

    Use Find Custom if you require more options to determine if the item is a match. Use Filter or Filter Custom to find all of the elements in a list the match a criteria.

    Output Fields

    • item (object): the first item in the list that meets the specified criteria.
    • index (number): the location of the found item in the original list, where 0 is the first item in the list. Returns -1 if there is no match.

    Table of Relational Operators

    Operator Use Case
    equal to Compare two texts, numbers, dates or true/false to see if they have the same value
    not equal to Compare two texts, numbers, dates or true/false to see if they have different values
    greater than or equal Compare two texts, numbers or dates to see if the first has the same or greater value than the second.
    less than or equal Compare two texts, numbers or dates to see if the first has the same or lesser value than the second.
    greater than Compare two texts, numbers or dates to see if the first has a greater value than the second.
    less than Compare two texts, numbers or dates to see if the first has a lesser value than the second.
    a multiple of Compare two numbers to see if items in the list are an exact multiple of the comparison. (e.g. 12, 0 and -4 are all multiples of 4, but 2, 3 and 7 are not.)
    in Compare two texts to see if items in the list are part of the comparison. (e.g. “test” is in “this is a test”, but there is no “i” in “team”)
    not in Compare two texts to see if items in the list are not part of the comparison.
    has key When an item in the list is an object and the comparison is text, tests to see if the object has a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “order_num”). Path only required when searching for a nested key.
    doesn’t have key When an item in the list is an object and the comparison is text, tests to see if the object does not have a key with the specified name. (e.g. true if item on the list is {“order_num”:123} and comparison is “name”). Path only required when searching for a nested key.
    is empty Checks to see if an item on the list is empty; ignores the comparison. What defines “empty” varies by type. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).
    is not empty Checks to see if item on a list is not empty. Note: Only works for Text and Object. (Numbers, Dates, T/F, are viewed as empty).

    Examples

    If the input list is [1,22,30,4,35,46] and operator is “greater than”, path is left blank, and comparison is 30, then the result item is 35 (the first number in the list greater than 30) and index is 4.

    If the input list is [{"name":"Bob","department":"Sales"}, {"name":"Sarah","department":"Engineering"}] and operator is “equal to”, path is “department”, and comparison is “Engineering”, then the result item is {"name":"Sarah","department":"Engineering"} and index 1, the first object in the list, in index position 1, where department is “Engineering”. If you ran the same check but with comparison “Marketing” then the result item would be {} and index -1 since no objects match.

  • Find Custom

    Find an item in a list by running a Child Flow on the items, one at a time, and returning the first item where the Flow returns True. (For simple searches, use the Find function instead.)

    To use this function, you’ll need a Child Flow that performs the test on each item, one at a time. Define fields on the event card that will be the inputs that you’ll use to determine whether or not the item is a match. At a minimum, you’ll need a field for the item from the list (which you can name whatever you want). Then build the rest of the child Flow, ending with a Return card with a single field of type True/False.

    Calling a child Flow allows you to do tests of any complexity (e.g. given a list of email addresses for a particular customer, you could look up to find the first one that already exists in your marketing database).

    To return all of the items that match a test, use Filter or Filter Custom instead.

    Input Fields

    Fill out the Find card as follows:

    • list: The list you want to search
    • flow: The child Flow (as described above) that will be called once for each item in the list, until a match is found
    • with the following values (dynamically generated):
      • item: (will have whatever name you chose when you created your child Flow) Click in the field that will hold the current item from the list and choose “Item.” (Or, in some instances, you may also be able to select a specific path within an object if only that value is needed from each item.)
      • You can have optional additional fields on the child Flow event card in child Flow you chose, and those will also show up as input fields.

    Output Fields

    • item: The first item in the list that results in the child Flow returning True. Make sure to set the type of _item_ to match the type of the list.
    • index: The location of the found item in the original list, where 0 is the first item in the list. Returns -1 if there is no match.

    Example

    If list is [2,4,12,7,3,8] and _flo_ is set to a child Flow that returns True if a number is an odd number, and Item is passed to the child Flow’s input, then the output _item_ is 7 (the first item in the list where the child Flow returns True) and index is 3.

  • Flatten

    Takes a list that contains lists and turns it into a single list.

    Examples:

    Input lists Output list
    [[1,2,3],[4,5,6],[7,8,9]] [1,2,3,4,5,6,7,8,9]
    [“one”, [“two”, [“three”, “four”], “five”], “six”] [“one”,“two”,“three”,“four”,“five”,“six”]

    A list of lists is not a type you normally would create, but it may be the case that you get it from a call to another application or API.

    Input Fields

    • lists (required) - the list of lists that you want to flatten

    Output Fields

    • list - the flattened list. Be sure to properly set the type of list you expect. For instance, in the first example above, you’d set the output list to be a list of numbers. In the second example, it would be a list of text.
  • For Each

    Process a list by calling a child Flow for each item.

    This function does not return any outputs - use it when you want to take action for each item in a list but don’t need any information back.  If you do need output values from your Flow, one of the other functions in the List category should work for you.

    To use this function, first build the child Flow that you will use to process each item – to be invoked once for each item in the list. Define the inputs for the Flow on that event card. Typically you would include one input for the item of the list, i.e. if the list is a list of text then one of the inputs should be text. You can also include other inputs, whatever your Flow needs. 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. No need for a Return card because no value gets returned to the For Each card. Save the child Flow and turn it on.

    Now go back to the For Each card,  input the list you want to use, 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 choose to have your child Flow to accept those as inputs. In addition, you can drag in outputs from previous cards in the Flow, in which case the same value will be used for each item in this list.

    Input Fields

    • list: The list to operate on
    • 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 when 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

    • (none)
  • For Each - Ignore Errors

    Process a list by calling a child Flow for each item.  This function is almost identical to the For Each function, with one important difference:  For Each will stop processing more items if an error occurs when processing one of the items in the child Flow. On the other hand, this function continues to process all items even if some hit errors in the child Flow. Here’s how to think about it:

    • Use For Each if your Flow is only successful when every child item is processed successfully.
    • Use For Each - Ignore Errors if some items are expected to have errors during normal operation.

    As an example of a Flow where some items are expected to have errors - suppose you are sending an email out to a list of email addresses.  Some of those email addresses will probably be out of date, so you may receive an error when trying to send to them.  But that error shouldn’t stop you from sending to the rest of the email addresses on your list.  So in this case, For Each - Ignore Errors is a great fit.  You can still replay the child executions, for example, if you want to retry any of the errors. For more details on using this card, please see the For Each topic.

    Input Fields

    • list (list of objects): The list to operate on
    • flow (button/object):  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 when you select the child Flow using the Choose Flow dialog
    • concurrency (number):  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

    • There are no output fields in this card.
  • Get First Item

    Given a list, return two outputs: the first item and the list with that item removed (aka Shift).

    Input Fields

    • list: The starting list. Be sure to set the type of the list (e.g. list of objects or list of numbers)

    Output Fields

    • list: Returns the list without the first item. (Be sure to set the type of the output list to match that of the input list.)
    • item: Returns the first item. (Be sure to set the type – e.g. if the input list is a list of numbers, then item should also be set to be a number.)
  • Get Last Item

    Given a list, return two outputs: the last item and the list with that item removed (aka Pop).

    Input Fields

    • list: A list of items. Can be set to any type, and then the output item and list should be set to match that type.

    Output Fields

    • list: A new list which is the same as the input list except with the last item removed.
    • item: The last item from the input list.
  • Includes

    Check whether a list contains a particular item. The output is a True/False value - it returns true if the list contains the item, false if it does not. The list can be a list of any type of item - a list of text, a list of numbers a list of objects, etc. The value must be an item of that type.

    Input Fields

    • list - required: the list to check.
    • value - required: the item to check for.

    Output Fields

    • result (true/false): true if the list contains the specified item

    Example

    list: [{"name":"Bob", "age":20}, {"name":"Jane", "age":25}, {"name":"Sally", "age":22} ]

    value: {"name":"Jane", "age":25}

    result: true

  • Index By

    This function is designed for a common API pattern, where a service returns a list of field values as a list of objects which each contain a field name as one key, and a field value as another key.

    In that case, this function can be useful in converting that list into an object that contains each field as a key-value pair.  Index By solves this problem by letting you specify a keyPath and a valuePath.  For each item in the list, the function creates a new key-value pair in the output object.

    For example, if you have this list:

    [
        {
            "fieldname": "x",
            "myvalue": "one"
        },
        {
            "fieldname": "y",
            "myvalue": "two"
        },
        {
            "fieldname": "z",
            "myvalue": "three"
        }
    ]

    and use Index By with keyPath=“fieldname” and valuePath=“myvalue” then it would output the following object:

    {
        "x": "one",
        "y": "two",
        "z": "three"
    }

    Input Fields

    • list (list of objects):  a list of objects
    • keyPath (text):  the key in the object that has the key names (“fieldname” in the above example)
    • valuePath (text):  the key that contains the values (“myvalue” in the above example)

    Output Fields

    • output (object):  an object containing the key/value pairs defined by the input list
  • Intersection

    Given two or more input lists, creates a new list that contains only those items that are included in all of the input lists. The lists can be of any type (text, number, object, etc.), as long as all lists are set to the same item type.

    Input Fields

    • list1:  The first list of items.
    • list2:  The second list of items.
    • (optional):  you can optionally provide additional input lists, with any field name.

    Output Fields

    • list (list of objects):  The list of items contained in all of the input lists.
  • Length

    Find the number of items in a list.

    Input Fields

    • list: Enter the list that you want to find the length of.

    Output Fields

    • length (number): Returns the number of items in the list.
  • List to Text

    This function generates a single text output from a list, using an optional separator. For instance if you have a list of product names, you can use this function to create comma-separated list of products to include in an email.

    The function works with lists of text, numbers, True/False, or Date & Time types. To create text from a list of objects, first use the Pluck function to get a list of the values from a single key of the objects, then pass that list into Join.

    Input Fields

    • list: The list to operate on.  This can be a list of text, numbers, True/False, or Date & Time.
    • separator (text):  Characters that will be inserted in the output text between each item. It can be a single character like a comma or more than one character, like a comma followed by a space.

    Output Fields

    • text:  The output text.
  • Map

    You can use the Map function to convert a list to a new list by running a child Flow for each item in the list. For more for information about child Flows, see What is a Child Flow?. For example, if you have a child Flow that converts numbers to text (1 to “1”), you can run that child Flow on a whole list at once using the Map function to go from [1,2,3,4,5] to ["1","2","3","4","5"]. Similarly, you might use Map to generate a list of row subtotals from a list of spreadsheet rows (objects). With the Map function, the output list always has the same number of items as the input list.

    • Defining a Child Flow with the Map Function
    • Filling Out a Map Card

    Defining a Child Flow with the Map Function

    To use this function, you need a child Flow that takes a single item in the list and calculates the value to use for the new list. This child Flow gets called once for each item in the list.

    Define fields on the event card that will be the inputs that help determine the corresponding value for the new list. At a minimum, you’ll need a field for the item from the list (which you can name whatever you want). Then build the rest of the child Flow, ending with a Return card that provides the value for the same position in the new list. If the new list will made up of items that are not type Object (e.g. numbers or text), then there should be a single return field of that type and its name doesn’t matter. If the new list will be a list of objects, then there should be several fields on the Return card: one for each of the keys of the object and the names of the fields must match the key names.

    Filling Out a Map Card

    Update the following input fields:

    • List: The starting list
    • Flow: The child Flow that is called once for each item in the list
    • With the following values (dynamically generated): Here you will see a list of all of the inputs required by the child Flow. You can use these like normal input fields, or (for at least one of the inputs) you can click the arrow to the right of the input to choose Item to send the list item for that input to the child Flow. In some instance, you may also be able to select a specific path within an object instead of Item.
    • Concurrency (number): Displays 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.

    The following output fields display:

    • New list: Displays the resulting list after the child Flow has executed on each of the items. Set the type of _new list_ to match the value being returned by the child Flow, or to Object if multiple values are being returned.
  • Merge

    Merge objects from two or more lists at matching offsets. If an item with the same key exists in multiple lists for the same offset, the value from the later list will overwrite the value from an earlier list.

    Input Fields

    • list1 (list of objects) - required: a list of objects to be merged
    • list2 (list of objects) - required: a list of objects to be merged

    Output Fields

    • output (list of objects): the merged list of objects

    Example

    Input list 1: [{"name":"Bob", "age":20}, {"name":"Jane", "age":25}]

    Input list 2: [{"name":"Bob", "height":62}, {"name":"Jane", "height":65}]

    Output list: [{"name":"Bob", "age":20, "height":62}, {"name":"Jane", "age":25, "height":65}]

  • Pluck

    This function takes a list of objects, and produces a sub-list.  It does that by plucking the key specified by key from each object in the input list, and putting those values into an output list.  The list input must be a list of objects, this function doesn’t make sense for any other kind of list.  The key input defines the key to pluck from each item; it can be a key name in the root of each item, or it can be a dot-delimited path that lets you specify keys in sub-objects. You must set the type of the values output list to be the type of the values at that key path; if you don’t set the type correctly, you will very likely encounter type mismatch errors when you execute your Flow.

    Input Fields

    • list (list of objects): The list to operate on. Must be a list of objects.
    • key (text):  The key to pluck from each input item. Can be a dot-delimited path.

    Output Fields

    • values:  The output list. You must set the type of items in the list to match the type of the values at the key that path defines.

    Example

    If list is [{"name":"Bob","gender":"male"}, {"name":"Sarah","gender":"female"}]
    and key is name
    Then values (which should be set to list of text) is: ["Bob","Sarah"]

  • Reduce

    This function produces a single cumulative value by running a Child Flow for each item in a list.  For example you can determine the largest number in a list of numbers, count how many text items start with “A” in a list of text, etc.  The result can be any type – not just a number – so you can also use Reduce to build text, date, true/false, object, or a list of any of those.

    Basically this works by calling a Flow on each item in the list, which outputs a “memo” value.  This memo is passed as input to the next iteration, and so on until the whole list has been processed - at that point, the final memo value becomes the output of this card.

    To use this function, you’ll need to create the Child Flow that gets called for each item. Define fields on the event card that will be the inputs that determine how to increment the cumulative value. At a minimum, you’ll need a field for the item from the list (which you can name whatever you want) and a field that will keep track of the accumulated value (which must be named “memo”).

    You can also include other inputs that your Flow may need.  After defining your inputs, build the rest of the child Flow, ending with a Return card (found in the Control category) that returns the new accumulated value – to be passed along with the next item in the list to the next call of the child Flow, or if there are no more items in the list, this will be the result of the Reduce function. If the accumulated value is a type other than an object (e.g. a number), there should be a single return field of that type and its name doesn’t matter. If the accumulator is an object, then there should be one field for each of the keys of the object and the names of the fields must match the key names.

    Input Fields

    Fill out the Reduce card as follows:

    • list: The list to operate on
    • flow: The child Flow (as described above) that will be called once for each item in the list
    • with the following values (dynamically generated):
      • item: (will have whatever name you chose when you created your child Flow) Click in the field that will hold the current item from the list and choose “Item.” (Or, in some instances, you may also be able to select a specific path within an object.)
      • memo: Set the type of this field to be the type you want your final result to be (e.g. if you’re using Reduce to get a sum, then the type should be number). Provide the starting value (e.g. for doing a sum, you’ll want to start with zero.)
      • You can have optional additional fields on the child Flow event card in child Flow you chose, and those will also show up as input fields.

    Output Fields

    • item: The resulting value after the child Flow has executed on each of the items. Make sure to set the type of item to match the type of the input memo.

    Examples

    Let’s say you have a list of numbers and want to use Reduce to determine the largest of those numbers. First you’ll need to create a child Flow. Start the Flow with a child Flow event and add two fields: “current item” (a number) and “memo” (a number).

    The next card is a Control - AssignIf function that outputs the larger of those two numbers.

    The final card is a Control - Return function that returns the output from the AssignIf card as the new memo. Save that Flow as “inner - max” and turn it on.

    Now, you can create a List Reduce card that accepts a list of number. Click the “Choose Flow” button and select the “inner-max” Flow you just created. Click the “current item” input and select “Item” from the dropdown. Click the “memo” input and enter zero (as the start value).

    Here’s what your Reduce card will look like:

    Here’s what the child Flow looks like:

    Here’s how the Reduce card will work for the above example:

    Let’s say you passed it a list value of [1, 7, 4, 19, 2]. The “inner-max” child Flow will get called 5 times – once for each item in the list as follows:

    • The first time, current item is 1 and memo is 0. The child Flow returns the larger of the two: 1.
    • The next time, current item is 7 and memo is 1 (the return value from the previous step). The child Flow compares them and returns 7.
    • The third time, current item is 4 and memo is 7.  The child Flow returns 7.
    • The fourth time, current item is 19 and memo is 7. The child Flow returns 19.
    • The final time, current item is 2 and memo is 19. The child Flow returns 19, and since there are no more items in the list, this becomes the final output.

    The above example involves simple math, but you can make your child Flow as complex as you need.

    It can contain If/Else conditions, complex calculations, or application actions.

    And it’s not limited to numbers and math: it can build a different type, such as text (e.g. using Concatenate) or a list (e.g. using List Add to End).

    Just make sure that the types match for memo and item on the Reduce card and the memo field on the child Flow’s event card. And the value returned by the child Flow on the Return card must also match unless the type is object, in which case there must be a field on the Return card that corresponds to each key of the object and they are named the same as the keys.

  • Reverse

    Reverse the order of the items in a list.

    Input Fields

    • list (list): the list you want to reverse

    Output Fields

    • reversed list (list): the list in reverse order

    Make sure that list and reversed list are both set to the same type.

    Example:

    If list is [1,2,3,4,5] then reversed list is [5,4,3,2,1]

  • Sample

    Generates a random sample from a list.

    Input Fields

    • list (list): a list you want to take a sample from – be sure to set the type of the list
    • amount (number): the number of samples you wish to return.

    Output Fields

    • samples: returns a random selection of the size specified from the list specified. Be sure to set the type of the output to match the type of the input list.

    Example

    Input list: [1,2,3,4,5] and amount 2, would return samples like [1,2] or [3,5] – a different random set of 2 each time it runs. (For the example, list and samples are both set in advance to be a list of numbers.)

  • Slice

    Choose a subset of a list using start and end points.

    Input Fields

    • list - the list you are starting with
    • start - the first item to include in the new list (where 0 is the first item)
    • end - the position to end (the item in this position won’t be included in the new list); if you leave this field blank, the slice will extend to the end of the list.

    Output Fields

    • slice - the new list (make sure you set this output list to be the same type as the input list)

    Examples

    If list is the list of numbers: [0,1,2,3,4,5] and start is 1 and end is 4 then slice is the list of number: [1,2,3]

    Or, if you use start 2 and leave end blank then slice is the list: [2,3,4,5]

  • Sort

    Sort a list from smallest to largest.

    Input Fields

    • list - The list you want to sort.
    • path - If list is a list of objects, path is the name of the key to sort the objects by or a path if the object contains other objects (e.g. “customer.lastname”); otherwise, you can leave path blank.

    Output Fields

    • sorted list - The list sorted from smallest to largest.

    NOTE: Numbers will sort differently if you are using a list of text versus a list of numbers (or if the chosen key of the object is text versus a number). In numeric sort order 9 comes before 80, but in alphabetical sort order “80” comes before “9”. If you need to convert from string to number, use Sort Custom instead where you call a child Flow to specify the value to use for each item.

    To sort by more than one key, use multiple Sort cards in a row, ending with the Sort using the primary key. To sort from largest to smallest, use Reverse after Sort. To do more complicated sorts, use the Sort Custom function which calls a child Flow to determine the value to sort each item by.

    Examples

    If list is [9,80,20,1] then _sorted list_ is [1,9,20,80] - number order for numbers

    If list is ["9","80","20","1"] then _sorted list_ is ["1","20","80","9"] - alphabetic order for lists of text

    If list is [{"name":"Nicole","value":10}, {"name":"Sarah","value":20}, {"name":"Emily","value":30}] and path is “name” then sorted list is: [{"name":"Emily","value":30}, {"name":"Nicole","value":10}, {"name":"Sarah","value":20}] - objects alphabetically sorted using name.

  • Sort Custom

    Sort Custom allows you to do a custom sort of a list by calling another Flow to generate the value used to sort each item. For simple sorts, use the Sort function instead.

    To use this function, you’ll need another Flow that calculates the sort value for an item. This Child Flow will be invoked once for each item in the list. Define fields on the event card that will be the inputs that are required to determine the sort 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 text. 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 inside 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 Sort Custom card, input the list you want to sort, 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 all of the items you want to sort
    • 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 the items, sorted from smallest to largest using the values returned for each item by the provided child Flow. The type of output list should be set to match the type of the input list (e.g. list of text).

    Example

    • You have a list of text, e.g. ["this","is","a","sample"]
    • You create a child Flow that accepts a text input and returns the length of the text
    • Using Sort Custom, provide the list input and choose the child Flow above. For the input to the child Flow, click and choose “Item” from the dropdown
    • The output list of the Sort will be: ["a","is","this","sample"] - sorted from shortest to longest
  • Sum

    Calculates the sum of a list of numbers. This function accepts only a list of type number. If your numbers are formatted as a list of text, you can use the Map function to convert each item from text to a number. If your numbers are stored inside a list of objects, you can use the Pluck function to generate the list of numbers you need to pass into Sum.

    Input Fields

    • list: The list of numbers you want to add up.

    Output Fields

    • sum:  The sum of the numbers in your list.

    Example

    If the _list_ input is [1,2,3] then the _sum_ output will be 6.

  • Truncate

    Cut a list down to a specified length.

    This function can operate on lists of any type. To ensure this works correctly, you should make sure that the input and output lists are set to the same type.

    Input Fields

    • list: the input list
    • size: the size you want to cut the list down to

    Output Fields

    • truncated list: a new list which is the original list cut down to the specified size.

    Example

    If list is [1,2,3,4,5] and size is 3 then truncated list will be [1,2,3]

  • Union

    Combine multiple lists into a single list of all of the unique values contained in any of the input lists. The lists can be of any type (text, number, object, etc.) as long as all lists are set to the same type, including the output list.

    Input Fields

    • list1:  The first list of items.
    • list2:  The second list of items.
    • (optional):  you can define any number of input lists, of any name.  They will be unioned in order.

    Output Fields

    • union:  The output list.
  • Unique Custom

    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.
  • XOR

    XOR, or “exclusive or”, takes two input lists and generates a new list that contains all of the items that are in one or the other input list but not both. The lists can be of any type (text, number, object, etc.) as long as both input lists and the output list are set to the same type.

    Input Fields

    • list1:  The first list of items.
    • list2:  The second list of items.

    Output Fields

    • list:  The output list, containing just those items that are in list1 or list2 but not both.
  • Zip

    Takes two lists of equal length and combines them into a list of lists of each corresponding pair. For instance, if you zipped together [1,2,3] and ["a","b","c"] you’d get a new list: [[1,"a"],[2,"b"],[3,"c"]]. The input lists can be lists of any type.

    Input Fields

    list1: The first list list2: The second list

    Output Fields

    list: The combination of list1 and list2 as described above.