List Input Attributes

Nected now supports a new List data type, enhancing the ability to define versatile input parameters for your rules. This addition allows you to incorporate lists of values as input attributes, enabling dynamic rule configurations.

Steps to Get Started:

  1. Add Input Attributes: Click on the "Add Input Attributes" button, and “1. Input Attributes” will be shown.

  2. Create New Field: Click on “+Add Field,” enter a Name for the attribute, and select "List" as the Data Type from the dropdown menu.

  3. Configure List Parameters:

    • After selecting the List type, the List Editor will appear, which you can also access anytime by clicking on the List Editor button.

    • Enter the values you want to include in the list. For instance, if you are creating a rule for promotional offers, your List might include string values like A,B,C or numerical values like 1,2,3 or can be alphanumerical values like Prod1,Prod2,Prod3.

    • Just in the right side of the Input field, there is a button to expand the input field, to add more values easily. After clicking this button this popup will open where you can add a larger list.

    • At the top right corner of the popup, there is another button >< to close the popup. After your editing is done, click that button and close the popup.

  4. Save and Define Properties: Once you have configured your List, save your input attibutes by clicking 'Save and Next' button and then comeback to the rule editor window.

  5. Utilize the List in Rules: Now the list attributes can be used to set up conditions in your rules. To do so, go to the Rule Editor and from the property dropdown to select the list attribute you just created. Now in the property you can choose between the first item of the list or the entire list as the property.

    • Using the Entire List: If you need to apply a condition based on all items in the list, select "Complete List" from the options. This allows you to set conditions that consider the entirety of the list. For example, you might use the "equals" operator to check if the list matches another list or specific values you input manually.

      For the entire list, you can either add manual values or can give another entire list as value as you've done in the time of configuring the list attribute. In case of adding a list(maybe another or the same list) you just need to select the list token from the dropdown and that's it. By hovering on the list name, you can see the list items as shown in the image.

    • Using First Item: To focus on the first item of the list, use the token list_attr[0] to target the first item of the list list_attr. This selection is particularly useful for rules that apply only under certain conditions based on specific list items.

  6. Test Your Rule: After succesfully adding the in conditions, execute the rule by clicking on the “Test Now” button.

  7. Review Output:

    • The output will demonstrate how the rule processed the input based on the conditions set.

    • This iterative testing process helps confirm the rule’s effectiveness and adaptability across different scenarios.

For List attributes, along with the generic operators, there are special List operators as well.

By following these steps, you can efficiently define custom input attributes using the List data type in Nected, focusing more on refining the logic and conditions of your rules without manual data entry.

Now, let’s see how list attributes interact with common/generic operators and list-specific operators.

Common/Generic Operators

  1. 1.Any: Checks if any element in the list meets a condition.

    • Example: any(x > 3 for x in [1, 2, 3, 4, 5]) returns True because there are elements greater than 3.

  2. 2.Exists: Not a direct Python operator, but conceptually, checking if the list exists (is not None).

    • Example: exists = [1, 2, 3, 4, 5] is not None returns True, indicating the list exists.

  3. 3.Does Not Exist: The inverse of Exists; checks if the list does not exist.

    • Example: does_not_exist = not [1, 2, 3, 4, 5] returns False, as the list exists.

  4. 4.Is Null: Typically applies to individual elements or objects; for lists, checks if the list is None.

    • Example: is_null = [1, 2, 3, 4, 5] is None returns False.

  5. 5.Not Null: Checks if the list is not None.

    • Example: not_null = [1, 2, 3, 4, 5] is not None returns True.

List Operators

  1. 1.Empty: Checks if the list is empty.

    • Example: empty = not [1, 2, 3, 4, 5] returns False, indicating the list is not empty.

  2. 2.Not Empty: Checks if the list is not empty.

    • Example: not_empty = bool([1, 2, 3, 4, 5]) returns True.

  3. 3.In: Checks if an element is in the list.

    • Example: 3 in [1, 2, 3, 4, 5] returns True.

  4. 4.Not In: Checks if an element is not in the list.

    • Example: 6 not in [1, 2, 3, 4, 5] returns True.

  5. 5.Contains: Similar to "In"; checks if the list contains a specific element.

    • Example: Same as "In".

  6. 6.Not Contains: Similar to "Not In"; ensures the element is not in the list.

    • Example: Same as "Not In".

  7. 7.MatchAll: Custom logic, not a built-in Python feature. Conceptually, checks if all elements match a condition.

    • Example: all(x < 6 for x in [1, 2, 3, 4, 5]) returns True.

  8. 8.Not MatchAll: Inverse of MatchAll; checks if not all elements meet a condition.

    • Example: not all(x < 4 for x in [1, 2, 3, 4, 5]) returns True, as not all elements are less than 4.

  9. 9.Equals: Checks if the list equals another list.

    • Example: [1, 2, 3, 4, 5] == [1, 2, 3, 4, 5] returns True.

  10. 10.Not Equals: Checks if the list does not equal another list.

    • Example: [1, 2, 3, 4, 5] != [6, 7, 8, 9, 10] returns True.

By following these steps, users can effectively manage and utilize list attributes in Nected to enhance their data processing and rule-based logic applications, making the most of the platform's capabilities for dynamic data interaction.

Last updated