Passing Data Between Nodes in Locale
Locale makes it easy to automate complex workflows by enabling seamless data flow between different nodes. Understanding how to pass data between nodes is crucial for creating efficient and dynamic automation processes.
Data Flow in Locale
Data in Locale flows from output handles to input handles. This means that any node receiving input from another node will have access to data from all preceding nodes in the sequence. This flow of data allows for creating complex workflows where each step can build upon the data generated by previous steps.
Accessing Data Using JSON Notation
Users can access the data of any previous node inside any input field by using JSON notation, also called data variables. For example, if you have a node named postgres1
that outputs user data, you can access the username in a subsequent node using the following notation:
{{ postgres1.data.username }}
This flexible approach allows you to dynamically insert data from previous nodes into the fields of subsequent nodes, enhancing the functionality and adaptability of your workflows.
Handling Arrays in Data
If the data coming from a node is an array, you can use array notation to access specific elements. For instance, if postgres1
outputs an array of user data, you can access the email of the second user in the array using:
{{ postgres1.data[1].email }}
Handling Node Deletion
If a node whose data is being used in other nodes is deleted, all affected nodes need to be revisited to fix the missing data references. Locale will not automatically resolve these issues, so it's important to review and update your workflow whenever changes are made to the nodes.
Missing Data Variables
In the case of a missing variable, Locale will leave the data field empty in the input fields where the variable was referenced. This ensures that your workflow does not break but continues to operate with the available data. However, it is a good practice to handle potential empty fields appropriately within your workflows to maintain robustness.
Using Data Variables
You can use data variables within any input fields across your workflow. This capability allows for creating highly customizable and context-aware automation processes. By leveraging data from previous nodes, you can tailor the actions of subsequent nodes to suit the specific needs and conditions of your workflow.
Examples
Example 1: Basic Data Access
Let's consider a workflow where data from a PostgreSQL node (postgres1
) is used in an email node:
- Trigger Node: A new record is added to a PostgreSQL database (
postgres1
). - Action Node: Send an email using the user data from the new record.
In the email node, you can use {{ postgres1.data.email }}
to dynamically insert the user's email address.
Example 2: Accessing Array Data
Now, consider a workflow where the data from postgres1
is an array of user records. You want to send an email to the second user in the list:
- Trigger Node: A batch of new records is added to a PostgreSQL database (
postgres1
). - Action Node: Send an email to the second user in the array.
In the email node, you can use {{ postgres1.data[1].email }}
to access the email address of the second user.
Example 3: Combining Data from Multiple Nodes
In this example, data from two nodes (postgres1
and salesforce1
) is combined to update a Google Sheet:
- Trigger Node: A new record is added to a PostgreSQL database (
postgres1
). - Action Node: Retrieve additional data from Salesforce (
salesforce1
). - Action Node: Update a Google Sheet with combined data.
In the Google Sheet node, you can use {{ postgres1.data.username }}
and {{ salesforce1.data.account_name }}
to update the sheet with the user's name and their account name.
Need Help?
If you have any questions or need assistance with using nodes and handles in Locale, our support team is here to help. Visit our Help Center or contact us directly at support@locale.ai.
Passing data between nodes in Locale is a powerful feature that enhances the flexibility and capability of your workflows. By understanding and utilizing JSON notation to access data variables, including handling arrays, you can create dynamic and adaptive automation processes that drive your business forward. Always remember to review and update your workflows when making changes to ensure data integrity and smooth operation.