Using Canonic Datasource Tables in Workflow Nodes

THIS PAGE
Introduction
Accessing Canonic Tables
Example Use-Case
Steps to Implement
Define Logic
Testing and Validation
Best Practices

Leveraging Canonic tables within workflow nodes allows for seamless data integration and manipulation. This recipe guides you through the process of using Canonic tables effectively in your workflow nodes.

Introduction

Canonic tables store structured data and can be interactively used within workflow nodes for various operations like reading, updating, inserting or deleting data.

Accessing Canonic Tables

  1. Identify the Table: Determine which table's data you need to access or manipulate within your workflow.
  2. Workflow Integration: Use specific nodes in your workflow to interact with the selected Canonic table.

Example Use-Case

Let’s consider an example where you want to update user information in a 'User' table based on certain conditions.

Scenario

  • Table: 'User'
  • Operation: Update user status based on their activity.

Screenshot

Steps to Implement

  1. Create or Select a Node: In your workflow, create or select a node where the table interaction will occur.
  2. Configure Node to Access Table: Set up the node to interact with the 'User' table. This may involve selecting the table from a dropdown menu or specifying it in a script.

Define Logic

Incorporate mongoose queries to interact with the Canonic tables. Mongoose provides a flexible way to query and manipulate data. For instance, you might need to check user activity and update their status accordingly using mongoose methods.

Mongoose Query Example

Here's an example of using mongoose to update a user's data:

return User.findOneAndUpdate({ _id }, input, {
  new: true,
  omitUndefined: true,
}).populate([])

This mongoose query updates a user's information based on their _id and returns the updated document.

Screenshot

Testing and Validation

  • Input Test Data: Provide test data that mimics real scenarios.
  • Execute Workflow: Run the workflow and observe the interaction with the Canonic table.
  • Validate Changes: Check the 'User' table to ensure that the data is updated as per your logic.

Best Practices

  • Data Consistency: Ensure the data sent to the table matches the table's schema.
  • Error Handling: Implement robust error handling for scenarios like missing data or network issues.
  • Performance Considerations: Be aware of the performance implications, especially when dealing with large datasets or complex operations.

Note: Integrating Canonic tables within workflow nodes is a powerful way to manipulate and use your data effectively. It’s important to thoroughly test and validate your logic to ensure seamless data operations.

Did you find what you were looking for?
👍
👎
What went wrong?
Need more help?We have a thriving Discordcommunity that can help you with all things Canonic. →