Using function nodes¶
The function nodes are described in a simple scenario with the examples of:
Context nodes¶
The context nodes are used to store and read the values with the associated context type and key. The supported context nodes are:
Note
You can store and retrieve data from context variables using the specific nodes.
Using store-ctx node¶
To store the values into the context using "store-ctx" node, follow these steps:
-
From the node palette, drag and drop the "inject" node from the input palette and "store-context" node from the function palette to the working area. Connect the nodes in a flow as shown below:
-
Double click on "inject" node to edit the properties. For more information, refer to Editing nodes.
-
Double click on "store-context" node to edit the properties.
- Enter the name as "store in context".
- Select the context type as "Flow".
- To select the respective key value, click .
-
Click "Done".
-
Save and execute the flow.
The values are stored into the context successfully. The output is displayed in the context data tab:
To refresh the display of updated key and value, click .
Using read-ctx node¶
To read the values from the context using read-context node, follow these steps:
-
From the node palette, drag and drop the "inject" node from the input palette, "read ctx" node from the function palette and "debug" node from output palette to the working area. Connect the nodes in a flow as shown below:
-
Double click on "inject" node to edit the properties. For more information, refer to Editing nodes.
-
Double click on "Read ctx" node to edit the properties.
- Enter the name as "read from context".
- Select the context type as "Flow".
-
To select the respective key value, click .
-
Click "Done".
-
Save and execute the flow.
The output is displayed in the debug tab:
Parquet node¶
To get the array object into parquet format using parquet node, follow these steps:
-
From the node palette, drag and drop the following nodes with the respective palette to the working area. Connect the nodes in a flow as shown below:
- Inject node
- Function node
- Two Parquet node
- Debug node
-
Double click on "function" node to edit the properties.
- Enter the "Name".
-
Enter the "Code".
msg.payload = [{ bool: true, num: 1 }, { bool: false, num: 2 }]; msg.schema = { bool: {type: "BOOLEAN"}, num: {type: "DOUBLE"}, }; return msg;
-
Click "Done".
- Enter the "Name".
-
Save and execute the flow.
The output will be displayed in the debug tab.