Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] How to concatenate column values from multiple rows in iDM?
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] How to concatenate column values from multiple rows in iDM?
 Login/Join
 
Member
posted
Hello, is there a way to concatenate column values from multiple rows using iDM GUI/DMC?

For example I have two columns with these rows.
MAKE MODEL
Nissan Xterra
Nissan Altima
Nissan Pathfinder
Honda Accord
Honda Pilot
Toyota Camry

I would like the output to be
MAKE MODEL
Nissan Xterra, Altima, Pathfinder
Honda Accord, Pilot
Toyota Camry

Thanks.

This message has been edited. Last edited by: <Kathryn Henning>,


iSM 616
iDM 7705
iDQC 802
WF 77
Windows 2008 Server
 
Posts: 29 | Registered: May 01, 2007Reply With QuoteReport This Post
Guru
posted Hide Post
Sure. Create a source transformation like this:

MODELS | A256V | IF MAKE NE LAST MAKE THEN MODEL  ELSE MODELS || ( ' ' |  MODEL ) 

Then in your SQL object

 
MAKE   | Group By
MODELS | Max   


Also if the source data is in a recent release of ORACLE or DB2 you can use DB_EXPR with the native SQL function LISTAGG.
 
Posts: 373 | Location: New York City | Registered: May 03, 2007Reply With QuoteReport This Post
Member
posted Hide Post
Thanks Clif.

I am using SQL Server 2012 for my data source. In regards to your comment about using DB_EXPR to invoke native SQL functions, is this expression available in source, SQL and target nodes in DMC?


iSM 616
iDM 7705
iDQC 802
WF 77
Windows 2008 Server
 
Posts: 29 | Registered: May 01, 2007Reply With QuoteReport This Post
Guru
posted Hide Post
Unfortunately there is no LISTAGG equivalent in MS SQL Server so DB_EXPR won't help in your case.

If you search for such a thing you'll find rather complex workarounds. They would be more suitable for use in a DBMS SQL Flow or a synonym created for an external SQL Script.

One more thing: for the technique I gave you works for your sample since all the rows with the same MAKE are grouped together.
 
Posts: 373 | Location: New York City | Registered: May 03, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
The row concatenation is better implemented in DBMS than WebFOCUS/DataMigrator. You'll find different ways like this:

http://stackoverflow.com/quest...a-single-text-string

One thing you need to keep in mind is that you have to set a size limit to the returned string. I've done something similar in DB2, and it caused a "buffer overflow" error when the string size was more than it could handled.


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
 
Posts: 147 | Location: Toronto (GTA) | Registered: May 25, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] How to concatenate column values from multiple rows in iDM?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.