Discussion Board for collaboration on QlikView Scripting.
the new report I have built is supposed to be run locally by the users whereby of course they use the qvd file.
It seems to me that the qvd file is being blocked as long as an app supposed to read it is open - even if it's not being read, can that be?
Anyway, our primary load_script runs once an hour and at that precise time, if the qvd file is blocked and cannot be written to, of course there is an error and the whole thing fails.
Is there any way I can prevent that?
Thanks a lot!
Solved! Go to Solution.
you couldn't access the field "Zeit_seither_min" directly - you will need a peek for this:
peek('Zeit_seither_min', 0, 'Tablename')
I assume it's the story about "... der Wald und die Bäume ..."
sorry, but I couldn't really see a solution in this thread because the thing that I suspect was there ruled out quite early on.
- In my instance, the "General script error" occurs after the script is actually finished, the last statement being a STORE, so I assume that the file is blocked for writing, and the only reason I can think of for this is that it is being read at that moment or an app supposed to read it is open - which I cannot really prevent since that is the real purpose of this report: To be opened and run locally by the users, which means reading that qvd file.
=> Could I somehow force that writing_process to take place, killing any read_process at that moment - the writing (which takes place every hour) is the more important one because there are some more things coming in the wake of that. There's no great damage done if there is a failure for one or both of the users of this report.
Yep - it worked fine right now ;-) - which, as far as I can see, proves that the issue is really that the file is blocked at that precise instant. (which is usually at about 12min past the hour, but that could change, and telling the users to watch the clock while working with the report is not a good plan ...)
I have an idea now - I could use the >> !!!inuse << file that is generated whenever a log file is currently being written to - if that is found, that means that the data_loading script is running and the other report should not be used for a few minutes - I can insert some code in the report itself to check that and trigger a message to the user ...
Okay, that is not quite as easy as it looked - I would have to construct a relatively complex filepath to reach it and then, that file is quite strange - it does not have a size and I cannot seem to load it in QlikView - can I use any of the file_attributes like filepath() or filebasename() to determine this?
Still, this solution would only be second-best - the best thing would be to simply force any reading_process on that file to stop as soon as the load_script comes around and wants to write to it.
Do you know any solution to this?
Another idea: I forget that file and I go for the regular log instead - that has a filesize all right, that is - as far as I can see - reset to 0 when the corresp. app starts and only after it has finished, the filesize goes up to whatever ... Let's see.
I don't think that there is any practically way to prevent an access to the qvd - then the potential causer will be the OS or any scanner which will run with very high access-rights and priority (I mean thinking about changing the access rights or something similar).
More helpful could be to initiate a new read-process on this qvd (within a sub-routine like in link above mentioned) like:
first 1 load * from qvd.qvd (qvd);
which might kick-off a new file-handling and resolve the blocking file-flag.
Another (and more expensive) workaround could be to store the qvd within a copy and doing some time later a renaming and/or moving/deleting from the origin-file and the new copy (it's rather the worse-case).
sorry, I don't quite get you.
However, I now have another idea - LOADing the filesize of the log_file works, but no real figure is loaded, so I can use the ISNULL() function to query whether the log is currently in use and not yet finished.
If I find that that is the case, I can trigger a MsgBox to the user and exit. That is still not an optimal solution because that way the user will have to wait about 20min though the time_window where that block can occur is only about 2min, but it is doable.
Thanks a lot for helping!
Maybe an other idea is to store the qvd with a timestamp and alter the loadscript to use the qvd to load the most current. The amount of files/space stored would increase, but maybe that can be solved by some archiving process. Additional advantage is that there is a backup of the old situation one can revert to and that the user is always able to load the qvd.
Load script for finding the most recent file would be along the lines of:
LOAD MaxString(Mid(FileBaseName(),10, 8)) AS PossibleDates
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
LET vLastDate = Peek('PossibleDates', -1);