Skip to content

Array Functions (Premium) action

Array Functions in Stack offer powerful tools for working with arrays (lists of data) within your automation workflows. These premium actions allow you to manipulate, filter, and extract information from data arrays, making your tasks more efficient and automated.

Array Functions are a set of premium workflow actions in Stack designed to manage and manipulate arrays (lists of data) within automation workflows. These functions appear when dealing with lists of objects, such as order line items or customer attributes, allowing you to extract, filter, or calculate data efficiently. This is particularly useful for businesses that want to handle basic data processing directly in Workflows without exporting data to third-party services.

Using Array Functions in Stack workflows provides numerous advantages:

  • Enhanced Workflow Automation: Automate tasks like filtering, sorting, or calculating data without needing external services.
  • Improved Decision Making: Extract meaningful insights from datasets in real-time.
  • Reduced Manual Errors: Automate complex calculations and data manipulations.
  • Customizable Actions: Tailor workflows to meet unique business needs with flexible array operations.

Follow these steps to set up and use Array Functions in a workflow:

  1. Access Workflow Builder: Open Stack, navigate to the Automation tab, and create or select a workflow.
  2. Add Array Function Action: Click “Add Action” and select “Array Function” under the Premium Actions section.
  3. Choose Function Type: Select the desired array function: Find, Filter, Find by Index, Line Items, or Math.
  4. Configure Inputs: Specify the input array. Define keys, values, or criteria based on the selected function type.
  5. Save and Test: Save the workflow and test the action to ensure it’s working as intended.
  6. Use The Value: Once the action is working, it will create a variable that you can reference in other actions.

Each Array Function type is tailored to perform specific operations on array data. Data for these functions can be collected from Shopify Triggers, Inbound Webhook Trigger, and Custom Webhook action response data.

The Find action locates a specific object in an array by matching a key-value pair. For example, you can check if a product, like “Laptop,” exists in a list of purchased items. If a match is found, it returns the first matching object.

The Find by Index action returns one item based on its position in the array. Arrays start at zero (0). For example, if there are three items: (0) Apple, (1) Banana, (2) Cherry, a request for the item at index position two (2) will return “Cherry.”

The Filter action returns an array of all objects that match a given filter or set of filters. For instance, you can filter objects by color “blue” or category “home.”

The Line Items action allows you to reconstruct arrays to fit a target action, such as a custom webhook, Google Sheets storage, or matching the Email Builder shopping cart structure. Customize key-value pairs in each item as needed.

The Math Functions action offers options like Sum or Avg to perform on numbers in an array. For example, sum all prices to get the total order value. Math operations include:

  • Sum: Add all values and return the total.
  • Min: Find and return the smallest value.
  • Max: Find and return the largest value.
  • Average: Calculate and return the mean.
  • Count: Count and return the total number of values.

Q: What type of data can be used with Array Functions?
A: Array Functions work with arrays (lists) of objects or numbers, often from triggers like form submissions, order line items, or API responses.

Q: Are Array Functions a premium feature?
A: Yes, Array Functions are part of Stack’s premium workflow actions and may incur a small fee each time they run.

Q: Can Array Functions handle nested arrays?
A: No, they are designed for one-dimensional (flat) arrays. Nested data requires custom solutions.

Q: Can I use multiple Array Functions in the same workflow?
A: Absolutely. You can chain Array Functions together for complex operations.

Q: How do I debug issues with Array Functions?
A: Use the “Test Workflow” feature in the builder to view outputs and ensure proper configuration.

  • Custom Code in Workflows
  • Math Operations in Workflows
  • How to Use If/Else Conditions in Workflows
Can't find what you need? Call or text +1 787 665-9212 or email [email protected].© Stack · Privacy · Terms