> ## Documentation Index
> Fetch the complete documentation index at: https://docs.versori.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transformer

> The transformer action is a drag and drop action that allows you to transform the data in your workflow.

<Tabs>
  <Tab title="Documentation">
    The transformer takes a source input and a target output, allowing you to expand objects, iterate over arrays, and use
    selectors from previous nodes in your boards.

    ### Initial Configuration

    The initial configuration of transformer assumes the source and target are the nearest connected nodes. To initialise
    the transformer, click configure:

    {" "}

    <Frame caption="Initial transformer config">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-sidebar.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=dbab31d98e365f4f633703884204ef37" width="597" height="401" data-path="images/transformer-sidebar.png" />
    </Frame>

    #### Override Input

    Additionally - you can configure the input to be from any previous node in your flow. Furthermore, you can select parts
    of data from a previous node. The only restriction is that the data you select must be an `object` type.

    {" "}

    <Frame caption="Override transformer input">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transfomer-override-input.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=ab2d5f5e4f00dfcf51a71fb4d175cf57" width="743" height="556" data-path="images/transfomer-override-input.png" />
    </Frame>

    ### Initial View - Leaf (Source/Target) Nodes

    The initial view of the transformer is the leaf nodes, these are the source and target nodes. The source node is the
    data that is being transformed, and the target node is the output of the transformer.

    The source node is defined as per the above initial configuration or the overridden input. The target node is defined by
    the next connected node in the flow.

    {" "}

    <Frame caption="Initial transformer nodes">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-initial-view.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=e55b5842414d921756df3f10d1b82dad" width="2012" height="783" data-path="images/transformer-initial-view.png" />
    </Frame>

    ### Getting Started

    The Transformer has multiple tools available to help navigate your data tree and to help deal with nested objects and
    arrays iterations.

    You can drag an edge (line) between two properties to connect them. This will map these two properties together. You can
    also add tools by hovering over the circles on the properties and clicking on the plus button that appears, bringing out
    the tool menu and clicking on one of the tool names.

    {" "}

    <Frame caption="Available transformer tools">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-tools.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=763909cd1d5d872f6e680d23a9df2b3c" width="985" height="716" data-path="images/transformer-tools.png" />
    </Frame>

    ### Expanding objects

    Object properties can be expanded in both source and target nodes. Expanding an object property will allow you to access
    the properties of the object as individual properties in the transformer:

    {" "}

    <Frame caption="Expanded objects">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-objects.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=607ecbb83d1536d59eed44bc714ad82e" width="2050" height="974" data-path="images/transformer-objects.png" />
    </Frame>

    ### Handling arrays/lists

    The Transformer has 3 tools currently for working with arrays/lists: `For Each`, `List Builder` and `List Generator`.

    #### For Each

    The `For Each` tool allows you to iterate over an array and perform actions on each item in the array. This tool can
    only be used as a source tool and must be used in conjunction with the [List Generator](#list-generator) tool.

    {" "}

    <Frame caption="Using the for each tool on lists">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-foreach.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=795806104500b64e2b00fc90817126c7" width="835" height="353" data-path="images/transformer-foreach.png" />
    </Frame>

    #### List Generator

    The `List Generator` allows you to generate a list of items, this tool must be used alongside the `For Each` tool - so
    that on every iteration of the `For Each` tool, it will generate a new item in the list. This tool can only be used as a
    target tool.

    {" "}

    <Frame caption="Generate a dynamic list of items">
      <img src="https://storage.googleapis.com/versori-assets/apps/user-docs/actions/transformer/transformer-listgenerator.png" />
    </Frame>

    #### List Builder

    The `List Builder` tool allows you to manually build a list of items - for example if you want to build a list with only
    one element, using parent properties of the source. This tool should be used as a target tool. You can click on the plus
    button at the bottom of the tool to add another element to the list.

    {" "}

    <Frame caption="Create a known list of items from any source">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-listbuilder.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=795e57379fe55b73571db4e3b7a4222c" width="938" height="748" data-path="images/transformer-listbuilder.png" />
    </Frame>

    ### Other Tools

    Additionally - there is also a `Selector` tool, which allows you to step back out of the tranformer and select a value
    from a previous node in your board. This tool should be used as a target tool.

    {" "}

    <Frame caption="Select a value from a previous node">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-selector.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=b00e053ba2cb79672d9461b73e44c389" width="874" height="518" data-path="images/transformer-selector.png" />
    </Frame>

    And finally there's the `Constant` tool, which allows you to add a constant value to your transformer. The type is based
    on the type of the property you're connecting to. This tool should also be used as a target tool.

    {" "}

    <Frame caption="Input a hardcoded value">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-constant.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=3d0f842f73df77ff5898b13a54f31079" width="783" height="354" data-path="images/transformer-constant.png" />
    </Frame>

    ### Validation

    The transformer will validate your configuration as you go, and will highlight any errors in red. Currently this just
    validates the property data type.

    <Frame caption="Validation errors">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-validation.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=b6a0f28ffe5e88d1439608f4ee742b6e" width="773" height="105" data-path="images/transformer-validation.png" />
    </Frame>

    ### That's it!

    All of these tools will allow you to build up a complex transformation of your data, empowering you to build powerful
    workflows.

    {" "}

    <Frame caption="Final transformer config">
      <img src="https://mintcdn.com/versori/MLQxCzirlhkpdf4y/images/transformer-fullboard.png?fit=max&auto=format&n=MLQxCzirlhkpdf4y&q=85&s=de5ed021a7839dcef36c648aabbcf842" width="1733" height="1008" data-path="images/transformer-fullboard.png" />
    </Frame>
  </Tab>

  <Tab title="Video Guide">
    <iframe width="100%" height="407" src="https://www.youtube.com/embed/SQx6kPLwKLg?si=UF_BUQQBlDZ6cbIM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
  </Tab>
</Tabs>
