Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I know it's possible to load pictures into QlikView. I'm not sure how right now since I haven't been working much with QlikView for a while now. The tool is not very much in focus these days.
Now, however, I have a task that I could very well use it for: I just need to load pictures saved with the .jpg ending - about 23.000, all with a seven-digit number as filename (like >> #######.01.jpg <<) - there are some with >> #######.02 << when the original ppt has two slides.
There is the task now to add to that seven-digit number another two digits, so the new format will be >> #########.01.jpg << - nothing else. I just have to load the files and save them again with the new name - the additional two digits aren't always the same, they have to be taken from another source, but that should not pose a problem.
I know right well that there are quite a lot of specific little tools for this task which would probably be faster because just renaming a file is logically faster than loading and saving it. The thing is that installing any kind of software in this company necessitates a rather lengthy process of checking and releasing by IT on different levels. So it would probably be easier to just do it with the tools we have. Runtime is not very critical as this will have to be done only once.
Can you tell me what would be the fastest way of doing this?
Thanks a lot!
Best regards,
DataNibbler
Something like this worked as counter in for each:
let counter = 1;
for each ...
...
let counter = $(counter) + 1;
next
- Marcus
Thank you so much!
I think I'm close to getting the command right now. I'll have the colleague tell me the correct directory now and for starters I'll copy ten files or so from there into a directory of mine for testing.
I'll report back here if I encounter any more difficulties, but I don't believe so.
Thanks a lot!
Best regards,
DataNibbler
Hi Marcus,
I think I have it now - well, nearly, but something is still amiss because it does not work:
- I first construct both the old and the new filename as variables, complete with double_quotes around them.
=> Those two commands look like that:
Let command1 = chr(147) & PEEK('Dateiname_alt', 1) & chr(148);
LET command2 = chr(147) & PEEK('Dateiname_neu', 1) & chr(148);
- The final command_variable incorporates those two and looks like this:
LET command3 = 'rename "S:\Quality\07 Qualitätssicherung\09 Identbilder syncreon\JPEG Identphoto\Tests_FH_20160111\' & '$(command1)' & '" ' & '"$(command2)"';
=> It looks like "rename "S:\[path]\2401633.01.jpg" "240163301.01.jpg""
It all looks good and it looks like that EXECUTE line is executed, at least it doesn't throw an error - but nothing is renamed.
P.S.: I guess there are too many quotes now, judging from the way it looks in a textbox on the GUI. Let's see ...
Okay,
it works now. I had only one single file in that directory for testing now, but if it works dynamically on one, it should work on 10 or whatever number of files I have.
Next I will try with 10 or so which have already been done, where I know the correct outcome so I can compare.
Hi Marcus,
I'm just in the process of "trying out" my routine - well, I have tested it successfully before - on a pack of 100 files - and it doesn't work.
So I deactivated the EXECUTE for now to test whether the routine correctly fetches all the numbers - and my table (with filenames and so on) only goes up to 71 records - in the debugger I should see it going 1,2,3 etc., but instead it goes like 66,67,68,68,68,69,69,70,70,70 ...
I'll have a closer look at it. Can you imagine what could be wrong there?
Thanks a lot!
Best regards,
DataNibbler
P.S.: It's not only the counter - the table effectively has only 71 or so records when it should have 100 for there are 100 files.
It looked that the routine skipped some of these files. I think that there are some conditions which didn't fit properly. You could look on the value from the counter-variable (log or variable-editor) and I think you will see a value of 100.
- Marcus
Hi Marcus,
nope - that is exactly the isue. The counter is incremented just as the table does - but strangely - i just had it run step-wise - beginning with the 15th file (from top) in the directory - it says "15 records fetched"
=> Then comes the name of the 16th file and again it says "15 records fetched
=> Then comes the name of the 17th file and - "15 records fetched"
=> I stopped it after the 18th file this time, when the Debugger again said "15 records fetched" and the counter had
reached 18.
So there seem to be several issues since the table never reaches 100.
Very strange, there is only a simple LOAD with the Concatenate option inside that loop, nothing more.
Best regards,
DataNibbler
P.S.: I now eliminated the connection to the database from the LOAD to see if that was the issue - it is one issue, but even without that, the files are seemingly not loaded - the Debugger encounters the 16th, 17th and 18th file and always says "15 records fetched"
=> And they are not loaded, I just checked in the listboxes - although they have the exact same format as the files before.
Assumingly it's a quite small issue with a big(ger) impact. I would probably add a rowno(), recno() - maybe in an additionally load with autogenerate - and trace the variables (counter, paths ...), maybe create another counter (at least one for each - nested - loop).
If you used error-mode anywhere within the script I would trace the error-variables, too.
- Marcus
Hi Marcus,
yep, I will do so. I have a few other things to attend to, so I can't look into it anymore today, I'll continue on this tomorrow morning. Then I will start to keep track of everything.
I've tried to do so already and the problem is with the 16th, 17th and 18th file from the top - those are formatted exactly the same as the files before, but for some reason they are not loaded - the counter increases to 18, but they are not loaded and I have no idea why.
They are all jpg files, but then I don't want to load the contents, just the filename(). I haven't used error-mode anywhere.
Well, let's see.
Best regards,
DataNibbler
OK,
I found some time after all - but there won't be much more for today.
I attach a little snapshot for you showing the first five files - the code I will also attach loops through all those files and loads the filename and some other things building on the filename including the new filename so that the file can be renamed using the EXECUTE statement within that same iteration. The EXECUTE is deactivated for now. The filenames are all supposed to be written to a table, but I could do without that - it is not needed for anything, I just need somewhere to put the old filename and work on it to get the new filename. But then I don't think that having a table is the problem here?
<=> Well, that's the theory 😉 The fact currently is, the code loads the first four files correctly - and at the 5th, it skips - the loop continues, the counter would increase (I have deactivated it for now, don't need it), but the filename and such are not loaded and the nr. of "records fetched" stays the same.
Talk to you tomorrow!
Best regards,
DataNibbler
P.S.: Maybe I should consider having one loop just loading the filenames and nothing more and then just process that table all in one go and then just loop another time, maybe with a FOR loop, that seems to be more robust, and do the EXECUTE stuff? I will try tomorrow.
P.P.S.: Nope - that doesn't change a thing. Still, the code loads the first 4 files and skips the 5th.