Skip to Content
avatar image
Former Member

Scalar UDF Inside A Graphical Calculation View

How to use UDF in graphical calculation view ? Which schema and what sort of permission will i need for aforesaid?

Add comment
10|10000 characters needed characters exceeded

  • Lars Breddemann

    I have the same question: How to use a scalar function in a calculated column in a calculation view.

    Background: I need the function IS_NUMERIC in a calculated column. So I created a scalar function IS_NUMERIC.

    I know how to use it in SQL:

    "SCHEMA"."package::IS_NUMERIC"("columnToCheck")

    But unfortunately the calculation view gets not activated using the above code in a calculated column.

  • Thx for sharing Lars. This is - again - very sad. This makes Graphical Calculation views not possible in many cases. Putting a Calculation view on top of a Table function is only beneficial in some cases.

  • Scalar UDFs are not supported in the expression editor for calculated columns.

    One way to get that sort of functionality into the graphical editor is to encapsulate it into table typed UDFs.

    Where you can use scalar functions with graphical calc views is the parameter conversion functions and the input parameter defaults.

  • Get RSS Feed

3 Answers

  • Nov 22, 2017 at 10:57 AM

    If your parameter was actually a date-data type, then users could only enter valid dates.

    So, I assume that’s not the case here. Maybe your data model uses the NetWeaver DATS implementation, which stores dates in NVARCHAR(8) on HANA, If that’s the case, you can use the DATS_IS_VALID() built in function.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 23, 2017 at 02:23 PM

    As stated by Lars Breddemann it is not possible to use a Scalar Function in a graphical calculation view :/

    Workaround is to use it in a Table Function.

    A Table function can be used in a graphical calculation view.

    I myself do sometimes mix Table Functions and Graphical Calculation Views. But many times a Graphical Calculation View is not needed any more after you have to use a table function any way.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 10, 2017 at 07:32 AM

    I am using SAP HANA 11. I have created something similar to ISDATE function to check whether a string is a valid date. I want to use this function to check input parameter is a valid date or not.

    Add comment
    10|10000 characters needed characters exceeded

    • You will mention the schema when creating the function: CREATE FUNCTION <schema>.<function>. You will need 'execute' on the schema where the function is created.

      Try the 'conversion function' option in the input parameter creation screen. That should work for you. But you might not be able to throw error message etc if the user enters a wrong date format.