Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Contributor III
Contributor III

Hi Kristopher,

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

Regards,

Atif

Miguel_Angel_Baeyens

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
Contributor III
Contributor III

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