List Editor

The List editor in Nected is a versatile tool designed for managing list data within various contexts. It offers two editing modes: a raw code editor for direct list input and a low-code interface with add-item buttons for easier manipulation. This dual functionality allows users to handle list data effectively across rule inputs, rule results, and workflow nodes. Additionally, the editor supports token integration, enabling dynamic and context-aware list data management.

How to access List Editor?

Same as the JSON editor, the List editor is also available inside:

  1. Rule

    1. As Input params

    2. Rule Result

  2. Workflow:

    1. In trigger node

    2. In SetVariable node

    3. Response node

Let’s see how you can access the List Editor and write your custom code there:

1. Rule Input Parameters

You can easily use the List editor within the input attributes as an input parameter in the rule editor. If you want to set exhaustive data inside a single parameter, using a list as input is ideal. Follow these steps to access and utilize the List editor for rule input parameters:

  1. Navigate to the rule editor by selecting the desired rule.

  2. Click on “+Add Input Attribute” to open the “Input Attribute” modal.

  3. In the “Input Attributes” tab of the modal, click on “Add field” and provide a property name.

  4. From the datatype dropdown, select List. This action will open the List Editor.

  5. In the List editor, you can add items for later use. Note that tokens cannot be used within the “Input Attributes” section.

Example Code:

Inside a List, you can add string, numeric, boolean, date, date time, nested list, and even JSON type data as well.

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  }
]

You can not use tokens for this scenario, as here you’re configuring the input attributes for the rule, so no tokens are available at this point.

2. Rule Result

The List editor allows you to manage the output results of rules effectively. Here’s how to access and use the List editor for rule results:

  1. Open the rule editor by selecting the desired rule.

  2. Navigate to the Result section of the rule editor.

  3. Click on “Add Result” and choose List from the dropdown list.

  4. The List editor will open, allowing you to add items. You can use tokens such as customInput, globalVar, outputData, additionalData, dataSet, and NULL in this section.

Example Code:

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true,
    "key_name_3": "2024-07-02",
    "key_name_4": {{.outputData.key_name_2}}
  },
  [
    "2024-07-02",
    true,
    "{{.outputData.key_name_5.key_name_1}}"
  ]
]

3. Workflow Trigger Node

In the workflow editor, you can configure input parameters for the workflow trigger node using the List editor. Follow these steps:

  1. Open the workflow editor by selecting the relevant workflow.

  2. Click on the trigger node to open a side modal, which contains three tabs.

  3. In the “Input Params” tab, select List from the dropdown menu to add items. This section functions as input attributes for the workflow editor, and tokens cannot be used here.

Example Code:

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  },
  true
]

Same as in the rule, tokens cannot be used in this section as the function as input attributes for the workflow editor.

4. SetVariable Node

The List editor can also be used to manage variables within the workflow set variable nodes. Here’s how:

  1. Open the workflow editor by selecting the relevant workflow.

  2. Click on the “+” icon and choose the SetVariable node from the list.

  3. In the side modal that appears, click on "+ Add Field” and select List from the dropdown list.

  4. The List editor will open, allowing you to add items. Tokens can be used in this section to make the list data dynamic.

Example Code:

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  },
  true,
  "{{.Code.output}}",
  {{.Discounting_Rule.additionalOutput.discount}}
]

5. Response Node

The List editor facilitates defining the response data for workflow response nodes. Here’s how to access and use it:

  1. Open the workflow editor and select the relevant workflow.

  2. Click on the “+” icon and select the Response node from the list.

  3. In the side modal that appears, choose List from the dropdown list to add items. You can use any available tokens in this section.

Example Code:

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  },
  true,
  "{{.Code.output}}",
  {{.Discounting_Rule.additionalOutput.discount}}
]

How to Use List Editor?

The List editor in Nected provides a flexible interface for managing list data, allowing you to switch between raw code input and a low-code, pretty format interface. This section will guide you through using both formats effectively.

Writing List Data in Raw Format

The raw format is ideal for users who are comfortable writing list data directly. This mode allows you to input list data with full control over the syntax and structure.

  1. Access the List Editor: Navigate to the relevant section (e.g., rule input parameters, rule results, workflow nodes) and open the List Editor as described in the respective sections.

  2. Select Raw Code Mode:

    • In the List editor, choose the option to write raw code.

    • This will present a text area where you can manually enter your list data.

  3. Enter List Data:

    • Write your list data directly into the text area. Ensure that the data adheres to standard JSON list syntax, including proper use of square brackets [], commas, and correct nesting for objects and arrays.

Example of Raw List Input:

[
  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  }
]

Writing List Data in Pretty Format

The pretty format, also known as the low-code mode, provides an intuitive interface with add-item buttons that simplify the process of structuring and editing list data. This mode is particularly useful for users who prefer a visual approach to list editing.

  1. Access the List Editor: Navigate to the relevant context (e.g., rule input parameters, rule results, workflow nodes) and open the List editor as described in the respective sections.

  2. Select Pretty Format Mode:

    • In the List editor, choose the option to write in the pretty format (low-code mode).

    • This will present a form-like interface where you can add items without manually writing list syntax.

  3. Add Items:

    • Use the add item buttons to create new items in your list structure.

    • Enter the corresponding values for each item. You can add nested objects and lists by selecting the appropriate options from the interface.

  4. Incorporate Tokens:

    • If tokens are available in the context you are working in, you can incorporate them into your list data by selecting from the available token options and assigning them to the appropriate items.

Example of Pretty List Input:

  1. Initial Items:

    • Add an item with the value "ABC".

    • Add an item that is a list containing 2000, "Nected", and "2024-07-02".

    • Add an item with the value "2024-07-02T05:47:10Z".

  2. Nested Object:

    • Add an item that is an object.

    • Inside the object, add a key named key_name_1 with a value of "Rule Engine".

    • Add a key named key_name_2 with a value of true.

This will automatically generate the list structure in a pretty format without needing to write the raw code manually.

Test & Save

After writing the List data you can test it using the test button and check if everything is working fine or not.

Troubleshooting Guide

  • Syntax Errors: If your list data contains syntax errors, the editor will highlight the issues. Correct the highlighted areas and revalidate your list.

  • Token Issues: Ensure that tokens are correctly referenced and available in the context you are using them.

Conclusion

The List editor in Nected is a powerful tool that enhances your ability to manage list data seamlessly across different parts of the application. By understanding how to access and utilize the List editor in various contexts, you can streamline your workflow and ensure dynamic, flexible data handling. For further assistance, refer to Nected's support resources or contact the support team.

This detailed documentation provides a comprehensive guide on using the List editor in Nected. Should you have any further questions or need additional examples, feel free to reach out for more information.

Last updated