Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

for each in unique file

Hi everyone !

i'm making an script that has a "for each " to stay more fast, because the script has a function call hierarchy, the "for each" is for any customer , the problem is when  I do store of file, I record only the data of the first customer.

follow below the part of the script

FOR Each a in 3,2,5

orders:

Hierarchy (order,order_father,level_order,,level_order,,treeview)

LOAD

         customer &'-'& order &'-'& product  as order ,

         customer &'-'&order_father &'-'& product as order_father

         customer &'-'& order &'-'& product  as order_level ,

Where customer = $(a);

NEXT

Store orders INTO ..\mylocal\file.qvd

DROP TABLE orders;

//finish

the script above is a little part of the scritp that I use

the problem is that, when I look the qvd, just customer 3 shows, if I to put "For Each a in 5,3,2", the customer that going  to show is 5

        

somebody have some idea ?,

thanks a lot

1 Solution

Accepted Solutions
Not applicable

Re: for each in unique file

Why are using For .. Each loop here ?

You can directly use Match function here like below:

orders:

Hierarchy (order,order_father,level_order,,level_order,,treeview)

LOAD

         customer &'-'& order &'-'& product  as order ,

         customer &'-'&order_father &'-'& product as order_father

         customer &'-'& order &'-'& product  as order_level ,

Where Match(customer,2,3,5);

Store orders INTO ..\mylocal\file.qvd

DROP TABLE orders;

While using the Hierarchy, the filed names created like Order1, Order2 somthing like

Please check the each inividual load inside for loop and check auto concatenate is working or not ?

2 Replies
Not applicable

Re: for each in unique file

Why are using For .. Each loop here ?

You can directly use Match function here like below:

orders:

Hierarchy (order,order_father,level_order,,level_order,,treeview)

LOAD

         customer &'-'& order &'-'& product  as order ,

         customer &'-'&order_father &'-'& product as order_father

         customer &'-'& order &'-'& product  as order_level ,

Where Match(customer,2,3,5);

Store orders INTO ..\mylocal\file.qvd

DROP TABLE orders;

While using the Hierarchy, the filed names created like Order1, Order2 somthing like

Please check the each inividual load inside for loop and check auto concatenate is working or not ?

Not applicable

Re: for each in unique file

hey !
thank very much, I don't knew of this Match command, thanks a lot, was very fast, my problem was resolved !


answer your question  "if  loop and check auto concatenate is working or not?"


I put "Concatenate" explict, I think that is workink, but I'll to invistigate the script with loop just for curiosity, and to post the result here

Community Browser