cancel
Showing results for 
Search instead for 
Did you mean: 

How to put IF and Else logic in HANA graphical Views

Former Member
0 Kudos

Hello ,

I am trying to convert a Scripted Calculation view to Graphical one.

Scripted one has a logic depending on the input parameter to execute a block of view/sql

Say .. If parameter has been passed. I check this my length of parameter. If more than Zero is Yes and IF ZERO is no.

{

yes block

}

else

{

No Block.

}

How can i achieve the same in CA graphical view.

Thanks in Advance.

Regards

Srikanth

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182114
Active Contributor
0 Kudos

Hi Srikanth,

As Florian mentioned the answer depends on your scenario, which is not exposed on your request.

Adding another solution with a different approach you can create two projections and later union it to prepare the output.

On each projection you put an expression as filter like:

projection source 1 expression: strlen( p_parameter) = 0

projection source 2 expression: strlen( p_parameter) > 0

The "magic" will happen on instantiation of view which will prune the false constant and execute only the true expression.

Hope this helps.

Regards, Fernando Da Rós

former_member405293
Discoverer
0 Kudos

thank you, really helps.

pfefferf
Active Contributor
0 Kudos

The solution depends on what your logic is in the blocks.

For easy cases maybe the replacement can be done using calculated columns, for complex cases which cannot be realized in a graphical way, maybe a table function is necessary (in which you can do the same SQLScript logic) which is used as data source in a projection node of the graphical calc. view.

Regards,
Florian