Albato
  • Language
    En
    English
    Portuguese
    Spanish
  • Welcome to Albato Help

    Iterator Tool


    IN THIS ARTICLE

    The Iterator tool takes an array of objects and splits it into separate elements so you can work with each one individually.

    In Albato, each object in an array is called a "String". The array itself is called "Strings". A typical example: a CRM deal with multiple line items. Each item is a String, and the full list of items is the Strings array.

    Every item has its own fields — name, quantity, and so on — and they all arrive together in one array.

    Example:

    {
    "dealName":"Deal 1",
    "items": [
        {
    "name":"Product 1",
    "quantity":"2"
        },
        {
    "name":"Product 2",
    "quantity":"5"
        }
      ]
    }
    

    Once you add the Iterator to your automation, it processes each element one at a time. Every step after the Iterator runs once per element. So if the array has two items, those steps run twice.

    You can also add other Albato tools after the Iterator to process each element further.

     

    When Should I Use the Iterator?

    Say you want to create an item in Inflow for each product in a Bitrix24 order. The problem is you don't know how many products each order will have.

    Place the Iterator before the Inflow New Item step. The Iterator will split the order into individual products, and the Inflow step will run once for each one. Five products in the order means five items created in Inflow.

     

    How to Set Up the Iterator

     

    CoinMarketCap and Telegram

    We want to receive a Telegram message when a cryptocurrency price changes, but only if the change is more than 1%.

    First, create an automation with CoinMarketCap and Telegram.

    image-3.webp

    Click the + button to add a tool.

    image-4.webp

    Select the Iterator from the list.

    image-5.webp

    Choose the string from CoinMarketCap that you want to split into separate elements.

    image-6.webp

    In the Telegram step, select the variables to include in the message.

    image-7.webp

    The automation is connected end to end. One issue: CoinMarketCap sends price change values as raw numbers with many decimal places.

    image-8.webp

    Add the Math Operation tool after the Iterator and before the Telegram step.

    image-9.webp

    In the settings, pick where to apply the operation, set the rounding type, and choose the number of decimal places.

    image-10.webp

    Now each value gets rounded before it reaches Telegram.

    image-11.webp

    Last, add a filter before the Telegram step to send the message only when the price change is above 1%.

    image-12.webp

    Set up the filter condition like this.

    image-13.webp

    Save and run the automation.

    image-14.webp

    Messages will now only come through for coins that moved more than 1%.

     

    Conclusion

    Now you can use the Iterator to handle arrays of any size in your automations — orders, deals, price feeds, or any other list of objects. If you have questions, reach out via the chat.

    Did this answer your question?