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.
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__YOURVAR. The lowercase var makes it easier to distinguish system variables (which begin with VAR_) and the double underscore makes the user variables appear at the top of the list of variables because of the alphabetical sorting.
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.
<?
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 Lobster_data 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
Profile variables are initialised at the start of phase 3. System variables are initialised at the start of phase 2. Variables with prefix MSG_CALL_ are initialised at the start of phase 1.
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. Lobster_data provides a programming interface (API) that also allows you to develop your own components in Java. For this, we offer in-depth training. If you are interested, please contact our support or sales staff. Lobster_data also offers the class com.ebd.hub.datawizard.plugin.ChangeVariables 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 each time the job is started, initializing the variables before phase 3. The variable values are set in the configuration file ./conf/PredefinedVariables.properties. The properties file looks like follows.
#Assign a value with <MYVAR>=<value>
#It should be noted that the variable used must be defined in the profile!
var__TEST=Hello
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.
Note: If you want to store values across jobs (or even profiles), you can use the functions save permanent(a,b,c), get permanent(a, b) and delete permanent(a, b).