Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Concatenate the values of multiple records for one field

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

1 Solution

Accepted Solutions
Partner
Partner

Concatenate the values of multiple records for one field

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.

View solution in original post

4 Replies

Concatenate the values of multiple records for one field

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

Partner
Partner

Concatenate the values of multiple records for one field

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.

View solution in original post

mov
Esteemed Contributor III

Concatenate the values of multiple records for one field

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.

Not applicable

Concatenate the values of multiple records for one field

Thanks a lot guys!

I like the simplicity of the concat() and group by combination!