Skip to Content
avatar image
Former Member

How to put IF and Else logic in HANA graphical Views

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 17, 2017 at 10:35 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 18, 2017 at 11:17 PM

    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

    Add comment
    10|10000 characters needed characters exceeded