Concatenated projection
Projection – Abstract
Purpose: Combines suitable return values from several Concat projections into a common string.
The Concatenated projection combines suitable return values from several Concat projections into a common string.
The number of concatenation projections is variable. The following cases must be distinguished:
Concatenated projections |
Return value |
Notes |
multiple projections |
Concatenation of the return values of all concatenated projections converted into character strings |
Default case 'concatenation'
Special case 'type conversion to String': |
exactly one projection |
Return value of the single concatenation projection without type conversion |
Special case 'no concatenation'
|
no projection |
Empty string ('') |
Special case 'no projection' |
Configuration
Parameter |
Type |
Decription |
Name |
String |
The optional Name parameter can be used to assign an (alias) name to the projection.
|
Concat projections |
||
|
The configuration for Concat projections is displayed in an Expandable element, which initially always appears 'collapsed'.
|
|
|
Initially, the list of Concat projections is empty. Only the read-only 'template' for the configuration then appears in the detail area. A click on the In principle, any Projections can be used as concatenated projections within the Concatenated projection as long as they provide suitable return values. |
|
|
If Concat projections have already been set up, clicking on the ►IMPORTANT◄ A configuration must also be made for each concatenation projection instance created, otherwise an error message (NullPointerException) will occur when the search is executed. An 'undefined' concatenation projection such as the following must therefore be "specified" by clicking on the menu icon (left) or removed again using the dustbin icon (far right).
|
|
|
To subsequently adjust the sequence of already configured Concat projections, they can be copied to the Lobster Data Platform / Orchestration clipboard using the context menu functions 'Copy' or 'Cut' in order to paste them in another position. On the other hand, the arrangement can also be easily edited in the tree view (on the left in the editor) by moving an individual interlinking projection to the new target position using drag & drop. In the specific example, the countryCode-zipcode concatenation' can be converted to zipcode-countryCode in two moves. This technique is also useful if you want to add an additional concatenation projection before the first instance. As usual, you can only add one subsequent instance to the list using the |
|
|
The more or less extensive list of Concat projections can be 'collapsed' again by clicking on the [-] symbol of the Expandable element.
|
|
|
Clicking on the minus symbol (top right) minimizes the configuration interface so that the Concatenated projection is only displayed as a whole. Then, as can be seen in the image on the left for the specific case, the column names for the contained concatenated projections appear as text concatenations. However, this is only the case as long as the Name parameter is not used to explicitly assign a column name (e.g. COUNTRY_ZIP). |
Examples
Typical use case: Concatenate property values
In the context of a CSV search for Users, the 'username' (username) and 'ID' (id) properties are concatenated using an underscore (_) as a separator in order to populate a 'proUser' column.
Configuration:
The screenshot on the right shows the configuration for the Concatenated projection:
|
|
Runtime example:
proUser
admindent_4151
adent2_2653
adent_2651
...
Special use case: Type conversion to a string (String)
In general, the 'Creator' (creatorId) and 'Last modified by ID' (lastModifierId) properties of an entity of any type directly reference the value in the 'ID' (id) property of the relevant user account.
However, the respective Long property (creatorId or lastModifierId) must not only be able to reference Users, but also Guest users. After all, if they are sufficiently authorized, they can also be responsible for 'creating' or 'modifying' an entity.
The 'ID' values for Users and Guest users are only unique within the respective entity type. When referencing (creatorId or lastModifierId), the 'ID' of a guest user is therefore mapped as a negative Long value.
If detailed data for referenced Guest users is included in the context of a search, the 'sign reversal' in the reference requires special precautions.
In the specific use case, a Subsearch projection determines the 'Login token' of the guest user, which is referenced in the 'Creator' property by a negative reference value 'indirect'.
This must be taken into account:
For normal Users, the Field restriction shown on the right in the condition of a Subsearch projection returns the matching user account (id) to the reference in the 'Creator' property (_parentQuery.creatorId) of the entity to which the parent search refers. The comparison here refers to Long values on both sides (test value/compare value). |
|
For Guest users, there must be a 'sign change' in the Subsearch projection condition for one of the two sides (check value/compare value), as the internal 'ID' for a guest user is not really negative. Unfortunately, Lobster Data Platform / Orchestration does not provide any calculation functions via Projections. Instead, we have to literally fabricate 'comparable' values by other means in order to resolve references for Guest users. |
Configuration:
The following configuration is aimed at ...
.... converting negative values in the 'Creator' (creatorId) property into a string and ...
... creating comparable character strings based on the positive values for the 'ID' (id) of the referenced Guest users.
Both tasks can be solved using a Concatenated projection, as the following configuration for the condition shows:
On the left-hand side (check value), the Concatenated projection is used to prefix the positive 'ID' (id) in the Subsearch projection of the guest user account to be evaluated with a minus sign (-). The Long value is automatically converted into a String during concatenation.
On the right-hand side (compare value), the Concatenated projection is used exclusively to formally convert the negative value from the reference into a String. This is achieved by concatenating the return value of the Property projection for the 'Creator' property (_parentQuery,.creatorId) a second concatenated projection with a static empty string ('').
►NOTE◄ Depending on the database system used, comparisons between String and Long values are also possible without explicit type conversion. This configuration could then be simplified somewhat. However, the condition may no longer work if the database system is changed or the configuration is transferred to a Lobster Data Platform / Orchestration system that uses a different database system. With the explicit type conversion to String via the Concatenated projection, the condition should be applicable across the board.