Reusing Global and System Parameters
Global and system parameters can be reused in the Project Parameter Configuration *.param
.
When does it make sense to reuse global and system parameters?
Reuse is useful so that parameters do not have to be redefined over and over again, but existing parameters can be reused, e.g. in Mappings or as parameters or Component Parameters in an adapter.
Note
To avoid naming conflicts, the name of parameters and parameter groups must be unique within a level (at root level and for nested groups).
Note
The following should be noted when reusing parameters in the Project Parameter Configuration *.param
:
- constants may only be reused in other constants
- global, system or project parameters may be reused in variables
- parameters must not contain cycles (e.g. variable b uses the value of variable a and variable a uses the value of variable b)
- only parameters of type String may be reused
Possible Use Case
In the File System Adapter a path can be set via Component Parameters. A destination folder with file name can be referenced here.
Note
Instead of a Component Parameter, another type of parameterization can also be selected (e.g. setting parameters directly on the adapter, see also Parameterization Options).
Example
In this process, one file at a time is written to a destination folder. The destination folder and the file name are defined via Component Parameters in the File System Adapter. Global, system and project parameters are reused in the Component Parameters.
Component Parameter in File System Adapter Write Calculation on FS:
%WORKING_DIR_ABOSLUTE%/%CURRENT_PROJECT%/%filePrefix%_%NOW%.txt
Component Parameter in File System Adapter Write Invoice on FS:
%fileRootPath%/%CURRENT_PROJECT%/%timestampedFile%
In the project parameter %fileRootPath%
, the following parameters are reused: project parameter (constant) %X4tempfileDirectory%
and system parameter %CURRENT_PROJECT%
.
In the project parameter %timestampedFile%
, the following parameters are reused: the project parameters %filePrefix%
and %textfileEnding%
as well as the system parameter %NOW%
.
Example of an XML structure with reused parameters in the Project Parameter Configuration *.param
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Parameters xmlns="http://softproject.de/parameter/1.0">
<Enums />
<Group name="FileSystem">
<ConstantParameter name="X4tempfileDirectory" type="String">
<Description>This parameter is a constant in a group in this param file.</Description>
<Value>%X4tempfileDirectory%\X4</Value>
</ConstantParameter>
</Group>
<ConstantParameter name="tmpDirectory" type="String">
<Description>This parameter is a constant on root level of this param file.</Description>
<Value>C:\Temp</Value>
</ConstantParameter>
<ConstantParameter name="filePrefix" type="String">
<Description>This parameter is a constant on root level of this param file.</Description>
<Value>FILE</Value>
</ConstantParameter>
<ConstantParameter name="textfileEnding" type="String">
<Description>This parameter is a constant on root level of this param file.</Description>
<Value>.txt</Value>
</ConstantParameter>
<VariableParameter name="fileRootPath" type="String">
<Description>The parameter %fileRootPath% contains the constant parameter %X4tempfileDirectory% and the system parameter %CURRENT_PROJECT%.</Description>
<Value>%FileSystem.X4tempfileDirectory%/%CURRENT_PROJECT%</Value>
</VariableParameter>
<VariableParameter name="timestampedFile" type="String">
<Description>The parameter %timestampedFile% contains the system parameter %NOW% the variable parameters %filePrefix% and %textfileEnding%.</Description>
<Value>%filePrefix%_%NOW%%textfileEnding%</Value>
</VariableParameter>
</Parameters>