Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

datanibbler
Esteemed Contributor

Exclusive access to Excel_files? Can it be worked around?


`Hi,

yesterday and today we had a case of one app failing, apparently because one of the Excel_lists used by that app were open (they have to be updated every day).

In both cases, after the list was closed and the app was started once more via QMC, it ran fine.

Is there any way to work around this? QlikView should actually not need exclusive access because it only reads and never writes.

Can anyone advise me on this?

Thanks a lot!

Best regards,

DataNibbler

Tags (1)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Exclusive access to Excel_files? Can it be worked around?

Hi DataNibbler,

extending the hint from Peter Rieper you could copy this opened "~$" file, read this copy and skip the origin file and delete the copy again. For this you would need to create a dynamically batch-statement and execute this - not really nice but it should work.

Maybe it's just easier to skip this file and to load it then tomorrow again ...

- Marcus

View solution in original post

7 Replies
prieper
Honored Contributor II

Re: Exclusive access to Excel_files? Can it be worked around?

You may check, whether there is a file with the same name, but preceded with "~$" - think this is the indicator that the Excel-file is under revision.

HTH Peter

datanibbler
Esteemed Contributor

Re: Exclusive access to Excel_files? Can it be worked around?

Hi Peter,

well, today I don't know, for some reason that log file seemed to not be there. But yesterday, that was exactly what the log_file showed - the last LOAD from an Excel_file showed that $ prefix in the file_name. I know from experience that this means that the file is open. And that was it yesterday. It was probably the same today.

=> The question is, can I work around that?

I am thinking of something similar to my "file_storage_check_app" that checks if in a certain location, there are 2 files (2 personnel plans), for the same cw and for different shifts - one early, one late. If not, the script runs (I have set the ErrorMode to 0 in that thing) and an email is sent alerting the people in charge that something is wrong there.

<=> Can I somehow make that easier and build it into the application itself?

Best regards,

DataNibbler

Highlighted

Re: Exclusive access to Excel_files? Can it be worked around?

In the QMC Task Properties on the Triggers tab is "Task Execution Options".  For this the default "Number of tries" is 1, but you could set it to 2 or even 3.  Then if the xls is locked and the task fails, it will try again and if the xls is no longer locked it will succeed.  A bit blunt I know but I have on occasion found it to be very effective.

datanibbler
Esteemed Contributor

Re: Exclusive access to Excel_files? Can it be worked around?

Hi Bill,

this would help - but I don't have this tab. Is that one only available with the Publisher, by chance?`

In that case, I cannot do that - we don't have it and as there is, for the time being, no management_focus on QlikView, chances that we'll get it are quite slim.

I just tried to reconstruct that event - to have a file under construction and try to load it while it is open - and not yet saved. But I cannot seem to do that - even though I have the file open, it still has its normal name, no $, and the script loads it all right.

Best regards,

DataNibbler

MVP & Luminary
MVP & Luminary

Re: Exclusive access to Excel_files? Can it be worked around?

Hi DataNibbler,

extending the hint from Peter Rieper you could copy this opened "~$" file, read this copy and skip the origin file and delete the copy again. For this you would need to create a dynamically batch-statement and execute this - not really nice but it should work.

Maybe it's just easier to skip this file and to load it then tomorrow again ...

- Marcus

View solution in original post

datanibbler
Esteemed Contributor

Re: Exclusive access to Excel_files? Can it be worked around?

Hi,

yes, I guess you're right. It is probably easier to just close the files if this happens and then to start the task via QMC once again.

bestofwest
Contributor II

Re: Exclusive access to Excel_files? Can it be worked around?

Simple copy the file to a Temp File (Execute command) and use it on QV Edit Script.

At end to script delete it (Execute command or Script) .