Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Scripting Concatenation and Loops....

I am having a newbie script problem with Qlikview that I was hoping someone could quickly help me with. I have some customer order data that includes the order number and order comments spread across multiple sequence lines. An example of the data is below the code example. I need to concatenate all of the sequence lines into a single record per each unique order #. I know I need to loop through the data (somehow) to read each line, but I am at a loss on how to accomplish that...?

Any help is greatly appreciated.

~ Kristopher


OrderComments:
LOAD
"ORDER_NUM" as OrderNum,
"SEQUENCE" as "OrdCom_Sequence",
"BOL_COMMENT" as "Order_Comment"
FROM ..\AllCompqvdfiles\GMFORDFC.qvd (qvd) WHERE COMPANY='$(Comp)';


[data example]

Order# Seq# Order Comments

---------- ------- -------------------------------------------------

435350 1 order comments here from customer
435350 2 order comments here from customer
435350 3 order comments here from customer
435350 4 order comments here from customer

[/data example]

Thank You!

3 Replies
mantaq10
New Contributor III

Scripting Concatenation and Loops....

Hi Kristopher,

I am looking for the same thing, were you able to solve it?

Regards,

Atif

Scripting Concatenation and Loops....

Hello Kristopher,

Concat may help you

Table:LOAD * INLINE [Order, Seq, Comments435350, 1, order1 comments here from customer435350, 2, order2 comments here from customer435350, 3, order3 comments here from customer435350, 4, order4 comments here from customer];
OrderTable:LOAD Order, Concat(Comments, '$$') AS OrderSeqandCommentsRESIDENT TableGROUP BY Order;


Concat() Function aggregates text expressions (fields, in this case).

Hope this helps!

mantaq10
New Contributor III

Scripting Concatenation and Loops....

ya i also used the concat approach, it works fine.