Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi QV Folks,
My Root folder is D:\TestQVD
Sub folders are Test1
Test2
Test 3
each sub folder have 5 same type of qvd's same date and time stamp
but no.of records/rows are different imagine(sales1.qvd, sales2.qvd, sales3.qvd, sales4.qvd,sales5.qvd)
Now the issue is
i want a for loop to load 3 qvd's into qlikview (sales 1, sales 3, sales 5) (These will change dynamically as per my wish )
i fallowed the below script but i am getting all 5 qvd's(sales 1, sales 2, sales 3, sales 4,sales 5)
how can i load 3 qvds from each folder ?
in advance thanks for your support.
Set vConcatenate = ;
sub ScanFolder(Root)
for each FileExtension in 'qvd'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
Task:
$(vConcatenate)
Load
*,
'$(FoundFile)' as SourceFile
FROM [$(FoundFile)](qvd);
Set vConcatenate = Concatenate;
next FoundFile
next FileExtension
for each SubDirectory in dirlist( Root & '\*.' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('D:\TestQVD') ;
You could use a loop-counter like this:
Set vConcatenate = ;
sub ScanFolder(Root)
let vLoopCounter = 1;
for each FileExtension in 'qvd'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
if match($(vLoopCounter), 1,3,5) then
Task:
$(vConcatenate)
Load
*,
'$(FoundFile)' as SourceFile
FROM [$(FoundFile)](qvd);
Set vConcatenate = Concatenate;
end if
next FoundFile
next FileExtension
let vLoopCounter = $(vLoopCounter) + 1;
for each SubDirectory in dirlist( Root & '\*.' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('D:\TestQVD') ;
In a similar way could be other checks implemented like a wildmatch on '$(FoundFile)' or similar.
- Marcus