Variables
Variables
Variables can be used in many input fields, templates and parameter fields of functions. The values will then be replaced by actual values during runtime.
Variables are to be distinguished from constants.
Variable categories
Two different categories of variables can be distinguished.
System variables
Profile variables
Variable types
Variables can have the data types "String", "Integer", "Double", "Date", "Boolean", "Float", "BigDecimal", "BigInteger", "TimeStamp" or "Blob".
Naming conventions
Allowed characters are a-Z and 0-9 and the special characters _ and #.
No whitespaces and no special characters besides _ and # are allowed.
The name may not begin with a number.
We recommend the naming convention VAR_NAME.
Creating variables
Variables are usually created in the profile. In addition, there is the possibility to create variables in a file ./etc/admin/datawizard/custom_variables.xml. Following is an example configuration file.
Note: See also section "Initialising Variables" below for another possibility.
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
definition
>
<
variable
name
=
"var__internal_booking_id"
value
=
"33"
type
=
"int"
description
=
"booking account"
/>
<
variable
name
=
"var__internal_error_msg"
type
=
"string"
reset
=
"true"
client
=
"-1"
/>
</
definition
>
Available attributes
Attribute |
Description |
name |
The name of the variable. |
type |
The type of the variable. Allowed values are int(eger), float, double, string, date, time(stamp), bigint, bigdec(imal) and boolean. |
value |
The initial value of the variable. |
description |
The description text of the variable. |
reset |
Allowed values: "true" and "false". Corresponds to column "Reset" in the variable dialogue of the GUI. |
client |
The client, for which the variable is created (-1 is the default client). |
Accessing variables
Variables in input fields are accessed with the syntax@VARIABLE@. In templates, you usually have to use the syntax {--@VARIABLE@--}. This is mentioned in relevant parts of the documentation. In parameters of functions, variables can be selected directly.
Initialising variables
Variables with prefix MSG_CALL_ are initialised at the start of phase 1.
System variables are initialised at the start of phase 2.
Profile variables are initialised at the start of phase 3. You will find an exception in the event-driven Input Agent "HTTP" .
You can also use the possibility to initialize variables with a Java class. The class must be derived from the class com.ebd.hub.datawizard.plugin.AbstractInitializeVariables. We provide a programming interface (API) that also allows you to develop your own classes in Java. For this, we offer in-depth training. If you are interested, please contact our support or sales staff. The class com.ebd.hub.datawizard.plugin.ChangeVariables is available as a default implementation. Add the following entry (already included as comment) to the configuration file ./etc/startup.xml to activate the class.
<
Set
name
=
"initVariableClass"
>com.ebd.hub.datawizard.plugin.ChangeVariables</
Set
>
The class is executed with each started job, initialising the variables at the start of phase 3. The variable values are set in the configuration file ./conf/PredefinedVariables.properties. The properties file looks like follows. It should be noted that the variable used must be defined in the profile. Alternatively, you can use class AddOrChangeVariables instead of class ChangeVariables class, in which case the variables do not have to be defined . Note: The variable is cast to the type it has in the profile. So if for example, the profile has a variable var__TEST of type Integer, the properties file specification var__TEST=Hello will result in value 0 for the variable because of the implicit type cast from String to Integer. If class AddOrChangeVariables is used, the variables always have the type String.
#Assign a value with <MYVAR>=<value>
#It should be noted that the variable used must be defined in the profile!
var__TEST=Hello
Note: If you want to store values across jobs (or even profiles), you can use the functions save permanent(a,b,c), get permanent() and delete permanent().