Skip to Content
avatar image
Former Member

Graphical model scenario in HANA

Hello,

If we have customer table with name, order status,,status description,and status as follows::

Custname Orderstatus Stat desc Status

C1 O1 Stat1 XYZ

C1 O1 Stat2 ABC

C1 O1 Stat3 DEF

C1 O2 Stat1 XYZ

C1 O2 Stat3. DEF

Is it possible to achieve the following output using graphical method:

Custname Orderstatus Status

C1 O1 XYZ|ABC|DEF

C1 O2. XYZ|DEF

Need the Status to be concatenated based on the customer name and order status

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 13, 2017 at 04:47 AM

    Nope, the corresponding aggregate function STRING_AGG() is not available in the graphical modeller.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 13, 2017 at 04:51 AM

    You can create a user defined table function using the STRING_AGG function mentioned by Lars to prepare your result. The result has to be returned from the table function. Within the graphical calculation view you can use the table function as data source for a projection node.

    Following select prepares the result for your (of course you have to adjust the column, table names to your real names):

    SELECT "Custname", "Orderstatus", STRING_AGG("Status", '|')
    FROM <your table>
    GROUP BY "Custname", "Orderstatus";

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded