Workflow Action - Array Function

Modified on: Sun, 8 Sep, 2024 at 12:44 PM

TABLE OF CONTENTS


Overview

The Array Functions action provides a way to handle lists and arrays of data within workflows. This is useful for processing information like product lists, customer preferences, or any data sets that involve arrays or multiple items. The action offers different methods to manipulate arrays, including finding values, filtering, and performing mathematical operations on list items.


Action Name

Array Function


Action Description

The Array Functions action allows you to manage and manipulate arrays of data from various sources. It offers several operation types, including Find, Find by Index, Filter, Line Items, and Math Functions. Each type enables you to interact with data in unique ways, making it easier to automate tasks based on lists or sets of values.


Action Details

How to Configure:

  1. Action Name: Enter a descriptive name for the action, such as "Process Product List."
  2. Action Type: Select the appropriate action type for your use case:
    • Find: Find a specific value in an array.
    • Find by Index: Get a value from the array using an index position.
    • Filter: Filter array items based on certain conditions.
    • Line Items: Work with lists that contain line item data (e.g., products, quantities).
    • Math Functions: Perform mathematical calculations on numeric values in the array.




Action Types Explained

Find

This action type searches for a specific value within an array. If the value exists, the action returns the item or items that match.



Field NameDescriptionMandatory
ArrayThe array to search.Yes
Search ValueThe value you're trying to find in the array.Yes


Example:

  • Use Case: Finding whether a specific product, such as "Laptop," exists in a list of purchased items.
  • Setup: Set the array to the list of purchased items and the search value to "Laptop." If "Laptop" is found, the workflow can trigger a follow-up action, such as sending a thank-you message.


-----------------------------------------------------------------------------------

Find by Index:

This action retrieves a value based on its position (index) in the array. Arrays in this context are zero-indexed, meaning the first item is at index 0.




Field NameDescriptionMandatory
ArrayThe array from which the value will be retrieved.Yes
IndexThe position (0-based index) to retrieve the value from.Yes



Example:

  • Use Case: Retrieving the third item from a list of booked services.
  • Setup: If the array contains services such as "Haircut," "Manicure," and "Massage," entering an index of 2 would return "Massage."


-------------------------------------------------------------------------------------------------------------------


Filter

This action allows you to filter array items based on specific criteria. You can apply conditions to each item in the array, and only the items meeting those conditions will be returned.



Field NameDescriptionMandatory
ArrayThe array to filter.Yes
ConditionThe condition to apply, e.g., greater than or equals.Yes



Example:

  • Use Case: Filtering a list of customer purchases to show only items priced above $50.
  • Setup: Set the condition to "Price > 50". Only items with prices above $50 will be included in the result.


-----------------------------------------------------------------------------------


Line Items

This action is designed to work with arrays that contain line item data, such as a list of products and their associated prices, quantities, etc. You can perform operations on the line items, such as summing totals or finding averages.



Field NameDescriptionMandatory
Line ItemsThe array containing line items.Yes
OperationThe operation to apply (sum, average, etc.).Yes


Example:

  • Use Case: Summing up the total quantity of items purchased from a list.
  • Setup: If the array contains quantities of items (e.g., 3 apples, 2 oranges), you can sum these values to return a total of 5 items.


-----------------------------------------------------------------------------------


Math Functions:

This action type performs mathematical operations on numeric values within the array. You can add, subtract, multiply, or divide array items.




Field NameDescriptionMandatory
ArrayThe array containing numeric values.Yes
OperationSelect the mathematical operation (Add, Subtract, etc.).Yes



Example:

  • Use Case: Calculating the total cost of items in an order.
  • Setup: If the array contains prices like [50, 20, 30], the "Add" operation will return a total of 100.



Suggested Triggers (But not limited to)

Here are some triggers that work well with Array Functions:

  1. Purchase Completed: Use an array function to find specific products or services in the purchase list.
  2. Form Submission: After a form is submitted with multiple selections, use array functions to process and filter the responses.
  3. Order Placed: Use array functions to calculate the total quantity of items or the overall price from an order.
  4. Customer Tag Added: When a customer is tagged with a specific value (e.g., premium customer), use array functions to filter or process data related to their profile.


Example:

  1. Action Type: Find
    Scenario: You want to check if a customer purchased a specific item (e.g., "Premium Membership") from a list of purchases.

    • Array: List of purchased items.
    • Search Value: "Premium Membership."
      If the value is found, the workflow could trigger an upsell campaign specifically for premium customers.
  2. Action Type: Math Functions
    Scenario: You need to calculate the total price of items in an order.

    • Array: List of prices like [30, 50, 100].
    • Operation: Add.
      The result is 180, which can be stored in a custom field or used to trigger a payment confirmation email.


Additional Notes:

  • Multiple Uses: Array Functions can be used in various contexts, from processing product orders to analyzing customer responses.
  • Premium Action: This action incurs an additional charge per execution, as indicated by the premium label.
  • Combining Actions: You can combine array functions with other actions like Math Operations or Custom Values to create complex workflows that automatically process data.


















































Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article