Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm new to Qlikview and was wondering if anyone would kindly share some scripting with me:
I'm trying to automate the conversion of CSV files into QVD format, but only need to convert the new files that get added to the folder daily and not the files that have already been converted previously. How do I go about doing this?
I've added an IF command in case the "Part Processed" QDV file doesn't exist.
Hi Shane.
I thinked in a process that simply only reads the files that you didn´t read, without take care in the date creation. This way, you could take time without reload and the application didn't depends on the date you run it.
If FileSize (Log.qvd)>0 then
Log:
Load * From Log.qvd(qvd);
Else
Log:
Load 'Log.qvd' as Loaded Autogenerate 1;
End If
For Each Files in ('Path\*.csv')
Let File=FileBaseName(Files);
If FieldIndex (''Loaded','$(File)')>0 then
TableToLoad:
Load * From 'Files';
Concatenate (Log)
Load '$(File)' as Loaded Autogenerate 1;
EndIf
Next
Store Log into Log.qvd(qvd);
First, is created Log.qvd with his each name in "Loaded" field. Then, before read a cvs file in the path, ask about the files loaded in Log (it every loads any csv file the first time), and loads and add the filename in Log.
At the next run script, the Log is created, and because of it, reads all "Loaded". In each step of the loop, File is the basename of the file will be loaded, FieldIndex searchs for this name in the Loaded field, and this is the way of only load new ones.
Of Course, you could do it with the full filename, and check a complete root and collect the data of every csv you need. When you move the data, you could clean the Log and keep going!
Thanx Sebastian, that's probably a better way of doing it then what I'd used.
Sorry, i see the post as "Useful" not "Resolved" and think they where not resolved!