Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: Calcluation view with Where condition

$
0
0

I have to correct myself regarding the point, that the functions "now" and "component" can be used in the filter expression (mixed that up with expressions for a calculated column). So for the filter expression you can go just the way with the input parameter.

 

But of course you can go a way with "view self calculated" filter values which restricts your data sets by a join.

 

Here is a simple example:

Unbenannt.JPG

 

  • The MISC_DATE table in the Data projection node contains a column with a date.
  • The CurrYearMin1 and CurrYearMin2 delivers the filter year information (current year - 1 and current year - 2 in my example) which are combined by a union (FilterYears). For both projections I used table SYS.DUMMY as base table to be able receive one data record for each projection. Here it has to be ensured that for the DUMMY field (coming from SYS.DUMMY) the "Keep flag" is set.
    The used expression to calculate the year is shown in the screenshot (functions component and now are used). add_years function did not work in an SQL expression on my SPS10 system, so i used a column engine expression.
  • In the FilterJoin join node the original data is "filtered" by the FilterYears coming from the join. For an easy join i create a calculated column in the Data projection node which determines the year from the date value (using the component function).

 

From a performance point of view, the approach with parameters will be faster than that one I explained.


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>