Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to implement Loop in qlikview script

Hi Everyone,

Here I Want to implement looping concept in qlikview but I'm not able to implement the same,

please anyone help me how we can implement loop .

The requirement is as below -

In this table I_Key and L_Key are primary key by using these primary key I want to calculate according to each ItemID to different location Qty should be 5.

ItemID
I_KeyLocationIDL_KeyQty

I1

1L115
I22L22
I33L33
I44L44
I55L55
I66L66
I77L77
I88L88
I99L99
I1010L1010
L1111
L1212
L1313
L1414
L1515
L1616
L1717
L1818
L1919
L2020

after implementing the loop concept the output should be as below- For each ItemID for 20 different location Qty should be 5.

l

ItemIDI_KeyLocationIDL_KeyQty
I11L115
I11L215
I11L315
I11L415
I11L515
I1

1

L615
I11L715
I11L815
I11L915
I11L1015
I11L1115
I11L1215
I11L1315
I11L1415
I11L1515
I11L1615
I11L1715
I11L1815
I11L1915
I11L2015

Thanks .

9 Replies
tresesco
MVP
MVP

Anonymous
Not applicable
Author

Hi Tresco,

Thanks for the reply but I'm not able to implement the concept according to the requirement,

Can you please provide a demo according to the same.

Thanks

tresesco
MVP
MVP

Have you gone through the page -12 ("Generating all combinations of several fields") of the pdf? That should help you. Otherwise, create a qvw with sample inline data and share.

Anonymous
Not applicable
Author

Hi Tresco,

I am attaching qvw file with qvd data file .

Please implement the loop concept.

Thanks

tresesco
MVP
MVP

PFA

You just need a simple outer join.

Don't get confused with table data in the front-end, it shows the unique combination only. Press Ctrl+T to go to table viewer, there you cn check the data in preview mode to understand the actual data.

Note frequency in the listbox as well for comprehension.

Anonymous
Not applicable
Author

Hi Tresesco,

Thank you so much for the reply but that is not correct output.

in this we need to apply the loop without looping concept I think its not possible .

in this table we have 10 different Itemid and 20 different locationid .

I want to fix qty = 5 according to each itemid corresponding to each different locationid for example

itemidlocationidqty
115
125
135
145
155
165
175
185
195
1105
1115
1125
1135
1145
1155
1165
1175
1185
1195
1205
215
225
235
245
255
265
275
285
295
2105
2115
2125
2135
2145
2155
2165
2175
2185
2195
2205

as usually for itemid 1 to 10.

thanks

tresesco
MVP
MVP

As I already mentioned, have you checked the preview of data?

Anonymous
Not applicable
Author

yes I have check . The problem is that L_key is the primary key of LocationID and I_key  is the primary key of itemid ,

so according to itemid and locationid it's primary key would be same .

I attach primary key only for applying the loop concept in data we have only locationid and itemid.

Thanks.

tresesco
MVP
MVP

That you have to decide against your actual data. I just tried to give you an idea how can be done (trick is that outer join).