Skip to Content
0

Graphical model scenario in HANA

Jun 12, 2017 at 06:52 PM

54

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Lars Breddemann
Jun 13, 2017 at 04:47 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Florian Pfeffer
Jun 13, 2017 at 04:51 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded