Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ashish_2511
Creator
Creator

Concatenate all values of a single key value to one delimited value.

Hi Community

Didn't know how to put up the heading but here's the sample data. Given below are the input table and the expected output table. Please suggest a way to achieve this.

 

InputOutput
RegionDataRegionData
APAC1APAC1,2,5
APAC2EMEA3,4,7
EMEA3LATAM6,8
EMEA4
APAC5
LATAM6
EMEA7
LATAM8

 

Thanks!

Sneh

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi Patnaik,

Please try the below script.

Table1:

LOAD * INLINE [
region, data
APAC, 1
APAC, 2
EMEA, 3
EMEA, 4
APAC, 5
LATAM, 6
EMEA, 7
LATAM, 8
]
;


NoConcatenate


table2:
load region,
Concat(data,',') as data
Resident Table1
group by region;


drop table Table1;

View solution in original post

9 Replies
Anonymous
Not applicable

Hi Patnaik,

Please try the below script.

Table1:

LOAD * INLINE [
region, data
APAC, 1
APAC, 2
EMEA, 3
EMEA, 4
APAC, 5
LATAM, 6
EMEA, 7
LATAM, 8
]
;


NoConcatenate


table2:
load region,
Concat(data,',') as data
Resident Table1
group by region;


drop table Table1;

Anil_Babu_Samineni

May be using this expression in Object

Region as Dimension

And Expression is This


concat(distinct Data,',',Data)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sdmech81
Specialist
Specialist

Hi,

Please find attachment ur data is loaded in inline and showed.

used like  =aggr(Concat((Data),','),Region)

Thanks

Anonymous
Not applicable

Hi Patnaik,

Use the same expression without distinct. It works.

Take Region as Dimension and Expression is concat( Data,',')

Anonymous
Not applicable

You Should not add Data again.

tamilarasu
Champion
Champion

Hi Snehasis,

Script Solution:

Input:

Load Region, Concat(Data, ',') as Data Group by Region;

LOAD * INLINE [

    Region, Data

    APAC, 1

    APAC, 2

    EMEA, 3

    EMEA, 4

    APAC, 5

    LATAM, 6

    EMEA, 7

    LATAM, 8

];

Front End Solution:

Straight/Pivot table

Dimension

Region

Expression

Concat(Data,',')

Capture.PNG

ashish_2511
Creator
Creator
Author

Thanks Sachin. I consider this to be the best solution from a front end perspective.

Regards

Sneh

ashish_2511
Creator
Creator
Author

Thanks! Nagaraj

I personally consider this to be the best solution from a back-end perspective.

Regards

Sneh

ashish_2511
Creator
Creator
Author

Thank you all for your valuable comments. I've got my answer

Regards

Sneh