Set Parameters
  • 31 Oct 2024
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Set Parameters

  • Dark
    Light
  • PDF

Article summary

Overview

The Set Parameters node offers a simple and efficient way to work with task variables. By using this node, you can:

  • Create new variables
  • Clean up variable names
  • Perform operations with variables that are too trivial for the Set Parameters node

Set Parameters vue

Settings

The Set Parameters node has the following parameters:

  1. (Optional) Title and Description: Name and details of the node.

  2. Parameters:

    • Key: Key to specify variables; use a unique name. When updating existing variables, use their original names as a key.
    • Value: The value you want to assign to the corresponding Key parameter. The value can be a constant, a variable reference, or a function applied to a variable.

    Note: For more information, go to Parameters and functions.

    • Type of data:
      • String (S)
      • Number (N)
      • Boolean (B)
      • Array (A)
      • Object (O)

    Note: For more information, go to Data types.

    • Code editor: Shows the JSON format of the entered key and value. You can write and include additional code, which will be executed when a task enters the node.
    • To add a key-value, click + Add “key-value” below the Key field.
    • To delete the key-value line, click the trash icon Delete icon on the right side of the key-value line.
  3. Other:

    • Alert if the number of tasks in the node queue reaches the following number: Helps monitor whether the number of tasks in the node exceeds the specified threshold. When selecting the checkbox, you have to enter the needed number of tasks in the field that appears below.
    • Maximum interval, for which the task stays in the node before being forwarded: The amount of time a task is allowed to be in the node can be set in seconds, minutes, hours, and days.
      Note: The checkbox has a minimum value of 30 seconds. You can set a shorter interval by using the Unixtime function.

    SetParam settings

Examples

Defining a new parameter

In the example below, you can see how to define a new parameter as a constant in a Process.

Set parameters - 1.gif

The value of a new parameter doesn't have to be a constant. You can assign it a value based on a task parameter or a value stored in a State Diagram.

Changing parameter value

Below, you can see examples of two ways of modifying the parameter value:

  • Replacing a value of an existing parameter with a new one.
    Set Param ex_1

    To perform the replacement, the parameter key specified in the Set Parameters node must exactly match the key of an existing task parameter. The parameter matching the key ensures that the correct parameter value is updated and prevents accidentally creating a new parameter with the same name.

  • Modifying a value of an existing parameter by using the $.math() function to add or subtract a certain value from the original value.

    If the task goes to the Error node for any reason after passing through the Set Parameters node, no parameters will be modified or added, and none of the changes specified by the Set Parameters node will be applied.

    Set Param ex_2

You can access a single task parameter or a whole task stored in a State Diagram by Getting Task Parameters from State Diagrams.

Error handling & troubleshooting

When an error occurs during the task processing, you may see the following error parameter names in the task.

Error parameter nameParameter type
__conveyor_set_param_return_type_error__Hardware (system error), Software (error in a node logic/settings).
__conveyor_set_param_return_type_tag__*Error tag.
__conveyor_set_param_return_type_description__Error description in human-readable language; can be static or dynamic.

*The error __conveyor_set_param_return_type_tag__may have the following values.

ValueCauseSolution
access_deniedYou don't have access to the Process.Contact the Process owner to give you access.
access_deniedYou are trying to send or receive tasks from another stage.Getting and sending tasks between stages is not permitted. Use the same stage to send and receive tasks.
access_refusedThe Process you are working in is not a State Diagram but it must be a State Diagram.Check the logic of using a State Diagram. For more information, go to State Diagram.
conv_not_found_or_deletedYou are trying to work with a non-existent Process.Use an existing Process.
not_found_conv_by_aliasYour alias refers to a Process that no longer exists.Use an existing Process.
set_param_task_size_overflow_limitThe size of the task data exceeds the specified limit set for your environment.Reduce the size of your task.
set_param_wrong_convert_paramParameter value conversion failed with the specified parameter type.Check and correct the parameter's data type specified in the error message.
set_param_wrong_create_objObject conversion failed.Contact the support team to send ExceptionReason.
bad_callback_nodeThe Process you are calling doesn't have the Callback node.Create the Callback node in the Process you are calling.

When working with your Process or State Diagram, you may encounter the following issues.

IssueCauseSolution
The Set Parameters node sends its tasks to the associated Error End node.The function was called by using a missing or incorrectly formatted parameter.Ensure all parameters used by your functions are declared and have the appropriate type. For example, to use the $.math({{x}}+{{y}}) function in a task, both x and y parameters must exist and have the Number type values.
The parameter accessed from another State diagram using conv/proc is missing in the State Diagram or has a different type than specified.Change the parameter type you are requesting or add the required parameter to the State Diagram. Note: Parameters of the String type are an exception. If the String parameter requested using conv/proc doesn’t exist in a State Diagram, the Set Parameters node will work without errors, but the new parameter will be empty.
The parameter has a non-numerical value, even though it was declared a Number. For example, x = 1abc (Number).When declaring the parameter, remove everything that isn’t numeric (values that are not 0-9 numbers, decimal points, negative signs, and so on) from the Value field.
The parameter was initialized in one key-value input field of the Set Parameters node, and then the same parameter was assigned a new value in another input field.Parameters get assigned a value after passing through the node. Therefore, you cannot modify the parameter in the same node it was initially set. To solve this issue, assign the parameter the needed value immediately or modify it later by using another node.

Was this article helpful?

What's Next