Including Texts in an Analytical Query

Objective

After completing this lesson, you will be able to enhance an analytical query by including texts

Texts

Dimension values are often meaningless without a corresponding description.

For example, the dimension value F001-A2-3S:220 might actually represent the product: Three speed 220v cooling fan. But unless the business user is familiar with all product IDs, a product description is essential to provide meaning, and should appear in the analytical query result.

The description is provided using a dedicated text field.

Texts fields are available for any dimension value if the relationship between the dimension value and the text field has been defined in the underlying cube model. Dedicated text CDS views are created to provide access to the short, medium and long versions of the text fields.

In the analytical query definition you simply need to specify the dimension without being concerned with how to define the text. The associated text is automatically available in the analytical query result if it has been modeled in the cube view. This is what we call implicit definition.

the code used to define the text location and how it appears in the query result

You can see we have included the DepartureAirportID dimension in the analytical query. In our example, a foreign key association from the cube view to the dimension view has been defined. Our text field is actually available in the dimension view. However, the dimension view might not have a text field and instead might have a text association to a text view to reach the text field. In both of these cases the text field becomes available for the DepartureAirportID column so that the name of the airport is displayed in the analytical query result.

If no dimension view is available, then an text association directly from the cube view to a text view is sufficient.

Note

You can see how a well-defined star schema provides many important features to the analytical query, such as texts, attributes and hierarchies.

In the analytical query definition you can choose the default position of the text using the annotation @UI.textArrangement. Here you can choose the values #TEXT_LAST,#TEXT_FIRST or #TEXT_ONLY.

Note

Remember, you are defining a default position of the text. The business user can change the position of the text in the query result if they don't agree with your setting. They can even hide the text or the value if it is not required.

Even if there are multiple fields available that define the text, for example short, medium and long text, the method above will always select the default text. The default text is defined in the text view and is usually the first text in the list of the annotation: @ObjectModel.text.element.

If you are not happy with the default text and you prefer to use a different text then you can define the path to the specific text field explicitly in the analytical query.

the code used to choose a text field other than the default text and how it appears in the query result

This method is also recommended if you are exposing the query to OData so that the OData service can handle the separately named text field.

Watch the video to learn how to work with texts in analytical queries:

Log in to track your progress & complete quizzes