Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

claude_jakob
New Contributor III

How to dynamically concatenate field values during load (Peek/while)

Hi

I am struggling with the following need within a Qlikview script:

I have an input table with 2 columns. Column1 has a ID (Pack ID), column 2 a text. During load I need to to dynamically create a table that:

- unique IDs

- concatenates the text (with "+" separator") if the Pack_ID is same.

- concatenated items need to be acendingly sorted.

I have the feeling I need to use Peek function, use variables and possibly a variable.

Input:

   

Pack IDContent
11Item C
11Item B
11Item A
12Item D
13Item D
13Item B
14Item F
14Item B
14Item D
14Item E
14Item A

Output needed:

   

Pack IDContent Concatenated
11Item A+Item B+Item C
12Item D
13Item B+Item D
14Item A+Item B+Item D+Item E+Item F

Any input much appreciated.

Thanks

Claude

Tags (2)
1 Solution

Accepted Solutions
sasiparupudi1
Honored Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

Use Concat

T1:

LOAD [Pack ID],

     Content

FROM

[\\lnn63f1\u_t1487402003\sasidp\My Documents\Qlikview\Example1.xlsx]

(ooxml, embedded labels, table is Sheet1);

T2:

Load

[Pack ID],

Concat(Content,'+') as Value

Resident T1

Group By [Pack ID]

Order By

[Pack ID],Content

;

drop table T1;

updated the syntax

View solution in original post

6 Replies
Highlighted
claude_jakob
New Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

Example file attached

sasiparupudi1
Honored Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

Use Concat

T1:

LOAD [Pack ID],

     Content

FROM

[\\lnn63f1\u_t1487402003\sasidp\My Documents\Qlikview\Example1.xlsx]

(ooxml, embedded labels, table is Sheet1);

T2:

Load

[Pack ID],

Concat(Content,'+') as Value

Resident T1

Group By [Pack ID]

Order By

[Pack ID],Content

;

drop table T1;

updated the syntax

View solution in original post

sasiparupudi1
Honored Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

PFA

claude_jakob
New Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

Thanks for the script.

Works as needed !

passionate
Valued Contributor

Re: How to dynamically concatenate field values during load (Peek/while)

Hi,

PFA,

Solution.

Regards,

Pankaj

sasiparupudi1
Honored Contributor III

Re: How to dynamically concatenate field values during load (Peek/while)

Please close this thread by marking a correct answer