Mapped join

images/download/attachments/167859654/image-2024-1-24_15-32-34-version-1-modificationdate-1706106754258-api-v2.png

A Mapped join enables access to data for a data field of an entity within the search, which can be found in a separate table on the database side.

In contrast to the Entity join, the Mapped join supports Restrictions for the implicit join for the (1:1) or (1:n) relation behind the data field path selected as the Join property when mapping field values.

The assignment can be additionally restricted using both the generic On condition and the generic Treat parameter. Both parameters allow the optional definition of Restrictions, which are combined in an AND junction with the implicit On condition. These restriction options are a typical reason for using a Mapped join. Unrestricted access to property values would also be possible directly via a Property projection using the path selected as the Join property.

Configuration

Parameter

Data type

Desscription

Specific parameters

Join Property

Data field path

The Combobox Join property supports the selection of a valid data field path in the context of the search either via dropdown or direct entry, which must be completed by clicking on the + symbol or pressing the 'Enter' key.

images/download/attachments/167859654/image-2024-1-24_15-33-37-version-1-modificationdate-1706106817777-api-v2.png

Treat

Search treat

The Treat parameter provides an optional configuration for 'Search treat' (Treat):

images/download/attachments/167859654/image-2024-1-24_15-34-23-version-1-modificationdate-1706106863239-api-v2.pngimages/download/attachments/167859654/image-2024-1-24_15-34-58-version-1-modificationdate-1706106898182-api-v2.png

The associated user interface (right) with the As and On condition parameters only appears after the 'Search treat' has been added in the context menu of the value configuration (left).

└ As

Entity type

In the Combobox for As, an entity type can be selected that overrides the entity type derived from the definition for the Join property for the Join alias for the context of the definition of the On condition parameter.

└ On condition

Restriction

images/download/attachments/167859654/image-2024-1-24_15-36-27-version-1-modificationdate-1706106987833-api-v2.png

For the definition of the On condition, the entity type selected under As applies to the Join alias.

In the example on the left, the overarching 'Entity' (Entity) type was selected for As.

A Simple property restriction was then selected under On condition.

The Combobox element for the Projection then only shows paths for fields for the Join alias a that are supported by the selected 'Entity' (parent) class.

Generic parameters

Join alias, Join type, Optional, On condition

see Entity join

Examples

Typical use case: (1:n) relation

The entity type 'E-mail' (Mail, see E-mails) uses a list field involved to list different 'e-mail participants' ('From', 'To', 'CC', 'BCC').

A Tuple search for E-mails should only output the visible recipient addresses (type 'To' or 'CC') in a 'recipient' column.

Configuration:

The screenshot on the right shows the configuration for a Mapped join, which enables the selective listing of 'e-mail participants':

  • The list field involved is selected as the Join property.

  • The Treat parameter is not used.

  • The name recipient is arbitrarily defined as the Join alias.

  • The default 'Left' is used for the Join type so that e-mails without addressees are also listed if necessary.

  • For the Optional option, the default selection is retained because the recipient values are to be summarized in a Collection projection (see below) so that only one output line per e-mail is required.

  • The On condition here is a Search junction that gives an OR junction to two instances of the Field restriction, each of which checks the match with one of the desired 'e-mail participant types' ('To', 'CC').

    NOTE◄ Instead of the OR junction, a single fField restriction with the 'In' compare type could also be used here if a static list of types is provided as a compare value (e.g. via a Create list resolver)

images/download/attachments/167859654/image-2024-1-24_15-30-57-version-1-modificationdate-1706106657288-api-v2.png

The Mapped join with the alias recipient provides the individual values for recipients, which can be prepared as list values for the output column recipients as shown on the right using Collection projection:

  • As the Property of collection, the path to the involved property of the recipient value is selected.

    NOTEinvolved.involved would list all participants (including 'BCC' and 'Von') past the Mapped join at this point.

images/download/attachments/167859654/image-2024-1-24_15-31-49-version-1-modificationdate-1706106709257-api-v2.png

NOTE◄ If an additional output column is only to specify the sender ( e-mail participant type 'From'/SEND_FROM), an additional Mapped join with an independent Join alias (e.g. sender) for the same Join property (involved) must be set up for this purpose. As each e-mail should only have precisely one sender, this can be defined directly as an output column via a Property projection (sender.involved).

Special use case: (1:1) Relation with constraint

The accounts for Users refer to an entity of the type 'address' via the 'address' (address) property, so that the address properties from the database table for Addresses (base_address) must be included if these are addressed in Projections in the context of a search for Users. The selection of a data field path such as address.name1 implies the join from the user table to the address table.

In the following example, a Mapped join with a secondary condition is used instead of the implicit join so that address data is not always 'added' but only when a secondary condition is fulfilled.

A CSV search for Users should always output the address field 'Name' (name1.address) in addition to the 'User name' (username), but only output further address data (here: 'City'/city and 'Country'/countryCode) if the 'Account number' (address.accNumber) address property begins with the number 1.

Configuration:

The Mapped join shown on the right serves as the basis for conditional access to a user's address:

  • The address property is selected as the Join property.

  • A Treat is not required.

  • The name addr was arbitrarily assigned as the Join alias.

  • The Join type 'Left' ensures that the CSV search can also list users for whom the address is not fulfilled due to the On condition or for whom no address is specified.

  • The default (selected) is retained for the Optional option.

  • In the On condition, a Field restriction compares the 'account number' (accNumber) address property with the static text 1% using the like compare type. This condition is fulfilled if the account number begins with the character 1 or only contains this character.

    NOTE◄ As there is a (1:1) relation, it would also be possible to select or enter address.accNumber as the property path in the check value. However, the reference to the Join alias is more precise in purely formal terms.

images/download/attachments/167859654/image-2024-1-24_15-28-11-version-1-modificationdate-1706106491336-api-v2.png

The screenshot on the right shows the Projections for the output columns of the CSV search

  • The first Property projection reads the 'username' (username) property directly in the user account.

  • The second Property projection accesses the 'Name' (address.name1) address property directly. This column is therefore always filled.

  • The third and fourth columns each address the 'city' and 'country' (countryCode) fields in the address via a Property projection using the Join alias addr, which provides data exactly when the On condition is met.

images/download/attachments/167859654/image-2024-1-24_15-26-53-version-1-modificationdate-1706106413140-api-v2.png