Singular attribute projection

Projection – Abstract

Purpose: Enables simplified access to the values of a singular attribute (without explicit configuration of a Join).

images/download/attachments/162409163/image-2023-12-11_13-35-7-version-1-modificationdate-1702298113409-api-v2.png

A Singular attribute projection searches the attributes of the attribute owner defined by the context or an explicitly defined Attribute owner path for attributes with the specified Type.

Depending on the optional selection for the Property to be evaluated, either the complete attribute value or the value in the selected Property appears in the return value of the Singular attribute projection.

Configuration

Parameter

Type

Description

Name

String

The optional Name parameter can be used to assign an (alias) name to the projection.

  • If no Name is specified, the name for the selected Property is used as the column name (if relevant).

Attribute owner path

Entity
(Projection)

An Attribute owner path only needs to be explicitly defined by configuring a Projection if the entity in the context of the search is not the owner of the attributes that are evaluated.

This is relevant in the following cases, for example:

  • The attribute owner is an entity included in the search via Entity join.

  • The attribute owner is a position of an entity in the context of the search.

  • The attribute owner is an entity embedded in the entity data in the context of the search, e.g. the 'address' (address) of an account (see Users, Company accounts).

Attribute

Class
(attribute type)

In the Combobox element for the Attribute parameter, a selection must be made from the options for the attribute type offered via a dropdown. Only the attribute types that the entity type of the applicable attribute owner supports per implementation are available for selection here.

NOTE◄ If no options are available for the Attribute or if options are missing, then the Attribute owner path may not have been set appropriately (e.g. the 'address' of an account for which no attributes are implemented).

Property

Property (of the attribute value)

The Combobox element for the Property allows an optional single selection for one of the properties of the attribute type selected by Attribute.

  • If no selection is made for the Property, the Singular attribute projection returns the complete attribute value (value).

  • There is no access to the properties of the parent-level attribute Entity (such as the id), which contains the value property.

Examples

Simple use case: Output property of a singular attribute in tuple search

Locations in three-dimensional space are often specified using a triple of numerical coordinates that define a position relative to a specific reference point in space.

The geographical location of a point is often defined, for example, using geocoordinates (angular degrees for longitude and latitude) in conjunction with the height above sea level.

As a custom type definition (see Custom type definition), a custom singular attribute 'PositionXyz' (PositionXyz) is defined, which can store three numerical coordinates (x, y, z) in double properties that can be interpreted as a payload as desired.

This singular attribute can be implemented for any other entities that require a location specification. The reference system for the location information can be completely different for each implementation context.

In the following example, the PositionXyz attribute is used in the context of a custom entity (see Custom type definition) 'Point of Interest' (POI), for which it is to 'encode' geocoordinates with altitude information.

In a tuple search for 'Points of Interest', the height above sea level (the value of the z-coordinate) should appear as an output column.

Configuration:

The screenshot on the right shows the configuration for two output columns of a tuple search:

  • The Property projection POI_NAME is used to output a name for the 'Point of Interest', which could also serve as a key value for later access to Localization.

  • The second column defines a Singular attribute projection that accesses the Attribute 'PositionXyz' (PositionXyz) and returns the value for its Property z (if available).

  • The Name ELEVATION_FT_AMSL is intended to ensure a clear interpretation of the numerical value in the output column: 'Altitude in feet (ft) above mean sea level'.


images/download/attachments/162409163/image-2023-12-11_13-58-58-version-1-modificationdate-1702299544249-api-v2.png

Runtime example:

   <core:TupleSearchResult maxResults="100" count="123">
<columns>
<name>POI_NAME</name>
<name>ELEVATION_FT_AMSL</name>
</columns>
<result>
<row>
<item xsi:type="xsd:string">GREENWICH_PRIME_MERIDIAN</item>
<item xsi:type="xsd:double">223.0</item>
</row>
<row>
<item xsi:type="xsd:string">TAJ_MAHAL</item>
<item xsi:type="xsd:double">240.0</item>
</row>
<row>
<item xsi:type="xsd:string">TOUR_EIFFEL</item>
<item xsi:type="xsd:double">108.0</item>
</row>
...
</result>
</core:TupleSearchResult>

More complex use case: Display geographic coordinates in text column

In the context of an overview for the entity type 'Point of Interest' (POI) from the previous example, an output column should display the 'Position' in meaningful text form, taking into account all coordinates from the 'PositionXyz' attribute.

Runtime example:

images/download/attachments/162409163/image-2023-12-11_12-6-14-version-1-modificationdate-1702292779739-api-v2.png

Configuration:

The screenshot on the right shows how a Chained projection for a 'Custom column' can be used in the data grid settings for the overview in order to access the individual values contained in the attribute via a Singular attribute projection:

  • The Chained projection uses a Singular attribute projection to access the 'PositionXyz' (PositionXyz) Attribute without specifying a Property. The complete attribute value is expected as the return value if the attribute is used.

  • The attribute value with the properties x, y, and z contains all the raw data for a complex location specification. A Concatenated projection serves as the next step in the concatenation, which combines these coordinates alternately with plain text for formatting into a common character string:

    • As a prefix for the 'latitude' (Latitude), a Literal projection defines the text LAT=. The corresponding value is appended via a Property projection for the x property.

    • The following Literal projection combines the unit of measurement (°) for the latitude and the prefix (LON=) for the longitude (Longitude), which is attached via a Property projection for the y property.

    • The following Literal projection combines the unit of measurement (°) for the longitude and the prefix (ELEV=) for the sea level, which the following Property projection provides for the z property.

    • The last Literal projection concludes the character string with a reference to the unit of measurement and the reference system for the height specification (ft (AMSL)).

images/download/attachments/162409163/image-2023-12-11_14-1-13-version-1-modificationdate-1702299678900-api-v2.png

NOTE◄ As the runtime example (above) illustrates, the Double values saved as coordinates appear here with a large number of decimals. When constructing the output string in the context of the Concatenated projection, there is no function available for formatting the numerical values with a limited precision.