save variable a(b) type-safe
This function saves value b into the variable with name a . Before saving, a type conversion is carried out for b into the data type of the variable.
Parameters
Parameter |
Description |
a |
Name of the variable. Important note: Use parameter type "Value" and select the desired variable from the list after clicking on the parameter field. Example: MY_VAR |
b |
Value to be saved. |
Return value and further type conversions on field and node
The return value of the function is the saved value converted into the type of the variable. Important note: This function is normally only used to assign a value to a variable. The return value is not normally used to set the value of a field or to calculate whether a node should be entered. The effects on fields and nodes are only described here to explain any phenomena that may occur.
If the function is executed on a field, a further type conversion (type variable → type field) may occur, depending on the type of the field.
If the function is executed on a node, it is entered if value true is given as the result after a further type conversion (type variable → type "Boolean"):
Type of variable |
Result |
String, Blob |
"true" if the text can be interpreted as a number and the condition for numerical values is fulfilled or if the text begins with a "t" or "T". |
Numerical type (e.g. Integer) |
"true" if the value is > 0. |
Date type (Date, TimeStamp) |
"true" if value after " 01.01.1970 00:00:00". |
Boolean |
No type conversion. true if the variable value is "true". |
Example 1
Assume there is a variable "MY_VAR" with the type "String".
We execute the function with the following parameters.
Parameter a |
Parameter b (parameter type "Value") |
MY_VAR |
sometext |
The variable then contains the value sometext. A type conversion was not necessary as the variable has the type String.
If the function was executed on a field with type String, the field then has the value sometext. Note: A type conversion was not necessary because the field, like the variable, has the type String.
If the function was executed on a field with type Integer, the field then has the value 0. Note: A type conversion from String (sometext) to Integer (0) was performed.
If the function was executed on a node, the node is not entered. Note: A type conversion from String (sometext) to Boolean (false) was performed.
Example 2
Assume there is a variable "MY_VAR" with the type "String".
We execute the function with the following parameters.
Parameter a |
Parameter b (parameter type "Value") |
MY_VAR |
text |
The variable then contains the value text. A type conversion was not necessary as the variable has the type String.
If the function was executed on a field with type String, the field then has the value text. Note: A type conversion was not necessary because the field, like the variable, has the type String.
If the function was executed on a field with type Integer, the field then has the value 0. Note: A type conversion from String (text) to Integer (0) was performed.
If the function was executed on a node, the node is entered. Note: A type conversion from String (text) to Boolean (true) has been performed, see table above.
Example 3
Assume there is a variable "MY_VAR" with the type "Integer".
We execute the function with the following parameters.
Parameter a |
Parameter b (parameter type" Value") |
MY_VAR |
text |
The variable then contains the value 0. A type conversion from String (text) to Integer (0) was performed.
If the function was executed on a field with type String, the field then has the value 0. Note: A type conversion from Integer (0) to String (0) was performed.
If the function was executed on a field with type Integer, the field then has the value 0. Note: A type conversion was not necessary as the field, like the variable, has the type Integer.
If the function was executed on a node, the node is not entered. Note: A type conversion from Integer (0) to Boolean (false) was performed.