Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
shansundar
Partner - Creator
Partner - Creator

Vbs script execution not working properly

Hello experts,

I have a vbscript which opens a qvw file and activates all sheets and close it. I'm doing this for Pre-caching my qvw application in the server.

Problem i'm encountering is when I run the vbs manually or through a bat file, the script works fine. But when I create a supporting task in QMC as mentioned below, vbs is not executed but the supporting task completed successfully.

Supporting task Command line : E:\Qlik\SourceDocs\QDF\5.Config\Pre_Cache.vbs


Can anyone please help me here.


Thanks,

Shan S

10 Replies
petter
Partner - Champion III
Partner - Champion III

Do you have a log from the task to share?

Do you do some logging in your VBS-script? If so could you share?

shansundar
Partner - Creator
Partner - Creator
Author

Hello Petter,

1. Attached the log for the supporting task.

2. I don't have any logging in the vbscript. Its very simple one which is running as expected when i run it manually from the Qlik server.

Thanks,

Shan S

petter
Partner - Champion III
Partner - Champion III

From the log I can see that it is a .bat file that obviously kicks of the vbs script. Be aware that bat files only returns the error code of the last command executed. So even though the task log says that it completed successfully doesn't mean that your VBS script executed sucessfully.

petter
Partner - Champion III
Partner - Champion III

Can you share the bat file and the vbs file too?

shansundar
Partner - Creator
Partner - Creator
Author

Please find the scripts below.

Bat file:

Start E:\QlikShare\SourceDocs\QDF\5.Config\Pre_Caching.vbs

VBS file:

set x = CreateObject("QlikTech.Qlikview")

set doc = x.OpenDoc("E:\QlikShare\UserDocs\Application.qvw","","")

set ActiveDocument = doc

loop_through_objects(ActiveDocument)

ActiveDocument.Save

ActiveDocument.CloseDoc

x.Quit

SUB loop_through_objects(ActiveDocument)

For s = 0 to ActiveDocument.NoOfSheets - 1

ActiveDocument.ActivateSheet s

Next

End SUB

Thanks,

Shan S

marcus_sommer

For me it's not quite clear if your routine should be executed by a macro-trigger or per EXECUTE statement. Macro execution doesn't work per qmc-tasks but an EXECUTE will work - but it need some security settings which changed between the last releases. If you searched for it you should find various postings here within the community.

Beside them I don't believe that your approach of pre-caching will work because you opened the application within the desktop client and not on the server. AFAIK they don't share their resources.

Do you use the preload-option within the qmc: Re: cache warmer? Another but far more complex approach might be to adapt the logic from here: Quick tips #15 - Pre-caching with JMeter.

- Marcus

shansundar
Partner - Creator
Partner - Creator
Author

Hello Marcus,

Thanks for your reply.

1. I'm not sure what you're referring to macro-trigger and Execute statement.

2. Yes, as you mentioned when I execute this script in desktop client, its not sharing its resources. Is there any way to execute this script in the access point directly.

3. Yes, pre-load is enabled for this app.

4. Let me try this JMeter one and get back to you.

- Shan S

marcus_sommer

Maybe you could find an (automated) way that the desktop client opened the application on the server - third item from the top in menu "file" - if not I think you will need the JMeter approach.

- Marcus

shansundar
Partner - Creator
Partner - Creator
Author

Marcus - Below script allows me to open the app in the server through desktop client and activates all sheets successfully, but I don't see the timestamp of SHARED file got updated.

Now my question is whether the app got cached or NOT, is there any other way by which I can confirm that the app is cached? Please advice.

Script:

set x = CreateObject("QlikTech.Qlikview")

set doc = x.OpenDoc("qvp://SERVERNAME/USERDOCS/Application.qvw")

Msgbox "successfully open the app"

loop_through_objects(doc)

doc.CloseDoc

x.Quit

SUB loop_through_objects(doc)

For s = 0 to doc.NoOfSheets - 1

doc.ActivateSheet s

Next

End SUB

Thanks,

Shan S