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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
panipat1990
Creator II
Creator II

Help

Hi,

  I am New In Qlikview..I want to Know About Loop(For loop)......With Example...Qvw File.......Where We Use For Loop...And Why We Use.....What Is Reason Behind It For Using Loop........How Would I know That I am Use LOOP........With Example

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

there could be lots of reasons to have a loop, the logic is to reiterate an operation more than one time, in the following example I have to concatenate files into one table doing some check

let path_Alles = '..\Allestimenti\pagella_cliente_Allestimenti_*.xlsx';
for each File in filelist (path_Alles)
IF(left(right(File,11),4)<=$(currYear)) then
PalletInfo:
LOAD
'PalletInfo'
as TableOrig,
if(Len([Reference Client])<>10, Repeat('0',10-Len([Reference Client])) & [Reference Client],[Reference Client]) as shipto_code,
'PALLET'
as type,
Upper(Trim(Subsubcategory)) as competitor,
[WEEK UPDATE] as dataAlles,
[sold to] as customer_code,
[Allestimenti Samsung: Quantità] as palletinfo_qty,
'-'
as pallet_material,
0
as palletinfo_prezzo,
'-'
as palletinfo_serie,
'1'
as datoAssoluto
FROM $(File) (ooxml, embedded labels, table is Display)
Where [WEEK UPDATE] >= 201223 and [WEEK UPDATE] <= 201240 and [Product (short)] = 'PALLET';
ENDIF
next File

View solution in original post

3 Replies
MayilVahanan

Hi

Please refer

Loading Multiple Excel Sheets Dynamically along with file name and sheet name

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
alexandros17
Partner - Champion III
Partner - Champion III

there could be lots of reasons to have a loop, the logic is to reiterate an operation more than one time, in the following example I have to concatenate files into one table doing some check

let path_Alles = '..\Allestimenti\pagella_cliente_Allestimenti_*.xlsx';
for each File in filelist (path_Alles)
IF(left(right(File,11),4)<=$(currYear)) then
PalletInfo:
LOAD
'PalletInfo'
as TableOrig,
if(Len([Reference Client])<>10, Repeat('0',10-Len([Reference Client])) & [Reference Client],[Reference Client]) as shipto_code,
'PALLET'
as type,
Upper(Trim(Subsubcategory)) as competitor,
[WEEK UPDATE] as dataAlles,
[sold to] as customer_code,
[Allestimenti Samsung: Quantità] as palletinfo_qty,
'-'
as pallet_material,
0
as palletinfo_prezzo,
'-'
as palletinfo_serie,
'1'
as datoAssoluto
FROM $(File) (ooxml, embedded labels, table is Display)
Where [WEEK UPDATE] >= 201223 and [WEEK UPDATE] <= 201240 and [Product (short)] = 'PALLET';
ENDIF
next File

jagan
Partner - Champion III
Partner - Champion III

Hi,

Check this link for sample for loop

Load Multiple excel sheets using For loop

Regards,

Jagan.