4

Calculation View Features of QRC2 2022

 1 year ago
source link: https://blogs.sap.com/2022/06/22/calculation-view-features-of-qrc2-2022/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Within the time frame of 2022 QRC2, several new calculation view features have been released in SAP HANA Cloud that can be used with SAP Business Application Studio. Some of these features are highlighted below.

Calculation View Snapshots

In tab “Snapshots” you can define individual queries for calculation views. Based on these queries procedures are generated that create, drop and insert into snapshot tables:

Define%20a%20snapshot%20query

Define a snapshot query

This provides a flexible means to store results as they are at a certain point in time. The life-cycle of these procedures is controlled by the calculation view.

In addition, a calculation view can be generated to easily toggle between the online and snapshot data:

Generate%20Interface%20View

Generate Interface View

interface%20view

Interface View that implements constant union pruning

With snapshots you have now an easy and flexible means to serve queries that do not need online data and by this reduce resource consumption. See the modeling guide and performance guide for developers for more information.

Comments in Expressions

Use comments in expressions to better document the intention behind expressions. This will help during later refactoring and improve collaborative working.

Comments can be entered using one of the two styles:

/* comment */

-- comment
Comments%20in%20calculated%20columns

Comments in calculated columns

Comments%20in%20filter%20expressions

Comments in filter expressions

Mapping of Session Variables

Session variables can now be mapped into input parameters. This helps to re-use existing calculation views with input parameters in scenarios in which session variables should be used.

Example

Input%A0parameter%A0IP_temperature%A0is%A0filled%A0by%A0session%A0variable%A0SV_temperature

Input parameter “IP_temperature” is filled by session variable “SV_temperature”

Input%A0parameter%A0IP_temperature%20is%A0used%A0to%A0filter%A0on%A0column%A0temperature
Input parameter “IP_temperature” is used to filter on column “temperature”
UnionPruningMapping.png
Union pruning is implemented based on constant column “temperature”

Example Query

SELECT
    "SalesOrderID",
    "temperature",
    SUM("year") AS "year",
    SUM("amount") AS "amount"
FROM "mapSessionVariable"
    (placeholder."$$IP_MinimumID$$"=>'1')
GROUP BY
    "SalesOrderID",
    "temperature"

Results

a) Setting session variable to “old” data

SET 'SV_temperature'='old';
session%20variable%20set%20to%20old%20data

b) Setting session variable to “new” data:

SET 'SV_temperature'='new'
sessionVariableResultNew.png
By mapping session variables into input parameters the re-use of existing calculation views with input parameter becomes easier in scenarios in which session variables should be used.

Median Aggregation

Median aggregations provide statistics that are more robust against outliers than statistics such as Average. The aggregation type Median is now available for measures and calculated measures.
Aggregations%20of%20type%20Median

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK