cancel
Showing results for 
Search instead for 
Did you mean: 

Variable based on Current Date in HANA View

0 Kudos

Hi Experts,

We have a Analytic View on top of MHND table in HANA.

I am trying to implement Restriction on the Analytic View based on Run Date (LAUFD) so that we get only last 45 Days.

We want to keep the restriction as dynamic (based on current date) and tried to implement it as LAUFD >= (Current_Date - 45).

I tried to create a Variable on Run Date but could not successfully implement it.

Thanks,

Krishnendu Roy.

Accepted Solutions (0)

Answers (1)

Answers (1)

patrickbachmann
Active Contributor
0 Kudos

Try using ADDDAYS function yet use a negative number in the expression of your variable;

something like this;

adddays(date(now()), -45)

-Patrick

former_member182114
Active Contributor
0 Kudos

Hi Patrick,

It should be input parameter + apply filter, no?

Variable need special client to process the variable and "send it back" on where clause.

Regards, Fernando Da Rós

patrickbachmann
Active Contributor
0 Kudos

Hi Fernando, he didn't mention his client requirement so I'm not sure the answer to that.  I just know I have it working successfully when previewing within Studio using this ADDDAYS method with variable.  But I would think the same expression would also work via the input parameter as you suggest depending upon their need.

-Patrick

former_member182114
Active Contributor
0 Kudos

Hi Patrick,

The Studio preview is one of that "special clients" that read the metadata and process constant/expressions if you go through hdbsql directly he will not give hint or calculate an expression for you.

After DP execution click on log and see that SQL generated have what you informed by you on where clause.

Regards, Fernando Da Rós

patrickbachmann
Active Contributor
0 Kudos

Hi Fernando, I understand exactly what you are saying.  I'm just not clear on what Khrisnendu needs.  ie: what his special client may be.

former_member182114
Active Contributor
0 Kudos

Sorry I didn't catched it on first read.

Let's wait his answer with mode details.