Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to concatenate rows in one field in this way:
Let's say we have this table:
Client Product
1 A
1 B
2 B
2 C
2 D
I would like to generate the following table:
Client Products
1 A - B
2 B - C - D
The amount of products per client varies.
Thanks for your help
Johan
Hi,
U can also use the previous tricks to concatenate the row values
Client Product
1 A
1 B
2 B
2 C
2 D
load Client,concat(Product,'-') as NewProduct resident Tablename group by Client;
Please refer attached application.
Hello Johan,
I'm not very used to do aggregations in the script, but this seems a good moment to do something like this:
Table1:LOAD Client, ProductFROM Source; Table2:LOAD Client, If(Previous(Client) = Client, RangeSum(Peek('ProductsAcum'), -1 * Products), 1) AS ProductsAcumRESIDENT Table1ORDER BY Client; // Table previously loaded with raw data
Hope that helps
Hi,
U can also use the previous tricks to concatenate the row values
Client Product
1 A
1 B
2 B
2 C
2 D
load Client,concat(Product,'-') as NewProduct resident Tablename group by Client;
Please refer attached application.
Johan,
It can be done by using concat() function:
concat(distinct Products, ' - ')
You can use it either in script or on front end, whatever you prefer.
Thanks a lot guys!
I like the simplicity of the concat() and group by combination!