Constant
Value resolver – Abstract
Purpose: Returns the value of a System constant defined for the current instance of the Lobster Data Platform server.
The Constant value resolver returns the value of a System constant defined for currently used instance of the Lobster Data Platform server.
The Constant name parameter must define the name of a system constant in the embedded _data by direct input of static text or by configuring value resolvers.
If the System constant addressed by the Constant name parameter is unknown in the current server instance, the return value is 'No value' ($null).
By definition, the value of a constant is always a string. Other data types can, as shown in the examples, be 'encoded' as a string (e.g. in JSON format) if necessary, which is converted back into an object during read access.
►NOTE◄ It is possible to define system constants with matching names but differing values for different Lobster Data Platform instances (e.g. for a 'live' and a 'test' system). This approach can be used to distinguish or identify the systems in the automation context. Moreover, specific content (e.g. URLs or mail addresses) can also be stored for each 'environment'.
►IMPORTANT◄ This value resolver is not available in a Client workflow.
Configuration
The Constant value resolver ignores the input value. However, it is available for value resolvers in the Constant name parameter.
The Constant name parameter identifies the constant whose value is read by default by the direct input of static text which must match the name of the constant (incl. upper/lower case). |
This configuration returns the value of the system constant which can be stored in Lobster_data e.g. as shown below: |
|
|
After clicking on the small gray arrow (in the lower left corner of the text field for direct input, see above), a Constant name parameter can be defined to 'build up' a text value at runtime, which must correspond to the name of a constant (incl. upper/lower case). The configuration on the right concatenates a static text with the internal name for the Current locale ('without country', see 'Examples' for details), so that one of the following constants is 'read': |
|
|
Examples
Simple use case: Globally defined sender address for e-mails 'from the system'
For e-mails sent by Lobster Data Platform / Orchestration, a default sender address should be applied, which is defined as the value of a System-Konstante (EMAIL_FROM_DEFAULT):
Configuration:
More complex use case: Assigning an e-mail receiver for the Current locale
In certain scenarios, an e-mail to a support address is to be generated automatically in the context of a portal provided by Lobster Data Platform / Orchestration.
Specific support addresses for selected languages are stored via system constants in Lobster_data:
At runtime, the program checks whether a specific support address is stored as a constant for the Current locale. If this is not the case, an address statically defined in the code is assigned as the recipient.
►NOTE◄ Alternatively, the Localization of Lobster Data Platform / Orchestration for a language-dependent assignment of a support address is also a good idea.
Configuration:
In the configuration for a E-Mail event action shown on the right, the (first) recipient is determined in the Recipient tab as follows:
|
|
Special use case: Providing a global value list for access via index
Lobster Data Platform / Orchestration offers Dynamic enumerations for the management of predefined and user-defined value lists, which support, among other things, a separation of the key value and label via Localization and, if necessary, Company specific localization.
However, a value list can serve the sole purpose of arranging specific values in a particular order, e.g. to make them addressable via the index position in the list. For this use, a value list can also be provided as a string in a system constant, which is only converted into a real list on access (by Lobster Data Platform / Orchestration).
The following examples illustrate the procedure.
Example: For a limited integer value range (here: 1-25) a conversion of index values into 'Roman numerals' is supported, e.g. to be able to output a sequence number (version, bullet, etc.) given as a long value in this format.
A system constant ROMAN_NUMERALS is created in Lobster_data, and the following string is assigned to it as a value.:
,i,ii,iii,iv,v,vi,vii,viii,ix,x,xi,xii,xiii,xiv,xv,xvi,xvii,xviii,xix,xx,xxi,xxii,xxiii,xxiv,xxv
Configuration:
A text value should identify the incrementally determined version number of a type in conjunction with the prefix 'Mk' ('Mark').
In a Concat strings value resolver, the following text components are concatenated:
|
|
Runtime example: (Output of the version designation with versionIndex = 7 in a notification message).