Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
i am using this script to concatenate files using loops, but with this loop there are many concatenations taking place and my data model doesn't look good...please help me how to avoid that using auto increment
//concate
FOR Each vfile in FileList('C:\Users\w_318460\Desktop\New folder\*.xlsx')
Concat:
LOAD
* from [$(vfile)]
(ooxml, embedded labels, table is Sheet1);
Concatenate
LOAD
* from [$(vfile)]
(ooxml, embedded labels, table is Sheet1);
NEXT vfile
Thanks
Yogesh
Could you detail what your issue is?
For example, how does your data model look like at the end and how do you want it to look like?
How are your input files named and is the structure of the input files the same?
Why do you load the input files twice?
Yea that's what it is loading twice and in my table viewer its showing like concat1,concat2. i want data to be loaded only once , cz i am new to qlikview i donno how to use auto increment ..so please help me how to do so.
my input files are named as emp1,emp2,emp3 etc.,
thanks Stefan for ua reply.
What do you mean with auto increment? Which value do you want to increment?
auto increment in the sense every file should be loaded until it reaches last file.
What is being incremented? And what makes it auto?
It should take every excel file one by one for that we need to use increment i guess.. i am not sure about it...
I will explain you complete scenario.
i have n number of excel files in a folder which will be updating every often...so instead of loading those each and every time i have used loops..but its loading twice..i want that to load only once so give some example script to get that fixed
FOR Each vfile in FileList('C:\Users\w_318460\Desktop\New folder\*.xlsx')
Concat:
LOAD
* from [$(vfile)]
(ooxml, embedded labels, table is Sheet1);
Concatenate
LOAD
* from [$(vfile)]
(ooxml, embedded labels, table is Sheet1);
NEXT vfile
Inside the loop you execute the same load twice. You load the data twice from the same file. That's why you have double the data you want. Remove one of the two load blocks.
The FOR EACH ... IN FILELIST() ...NEXT
should take care of iterating over all files in your folder, no need for additional actions
If you want to load the tables only once, then do so (remove the second load). Tables will be auto-concatenated if the structure (field names) is identical in all files:
FOR Each vfile in FileList('C:\Users\w_318460\Desktop\New folder\*.xlsx')
Table:
LOAD
* from [$(vfile)]
(ooxml, embedded labels, table is Sheet1);
NEXT vfile
If i remove any one of the block i wont get result. say if i remove first one script will fail and if i remove second one next file wont work..
Gysbert can u alter that script and reply me?
Thanks in advance