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: 
Not applicable

Creating a VBScript for EDX

Hi All,

I am very new to QlickView, I have vast experience in using Business Objects but this is my first assignment with QlikView. We are upgrading to QV11 and one of the hurdles I am facing is to update the report "Reload" button which executes a "Task" in QV10. Apparently from reading blogs and community articles I have realized that there are a few .NET C# based resolutions; however in my case we don't want to use that route. So any pointers or any guide with this would be really helpful.

Regards,

Nitin

43 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi Anju,

When you say "My problem is in IE...", is it when you are accessing via a client machine or locally on the server?

I think that when you are running a macro via IE Plugin in a client machine, the macro runs locally in the client. So if your code uses the "C:\Program Files...." folder from the server, the macro will try to find it locally, and will crash.

Not applicable
Author

Hi Fernando,

     I am running it on the server. I also tried running a macro only for displaying the message, but this also did not work.Maybe I should make some configuration changes so that popups can appear?

-Anju

fosuzuki
Partner - Specialist III
Partner - Specialist III

Are you using IE Plugin or AJAX to access the application through IE?

Not applicable
Author

I am using IE plugin

Not applicable
Author

Sorry, its Ajax plugin.

Not applicable
Author

Hi,

Is there any workaround to enabling popups while using Ajax plugin?

-Anju

fosuzuki
Partner - Specialist III
Partner - Specialist III

The msgbox function will not work in AJAX. The idea is that all the macro code will be run in the server side and the server will push to the browser only the HTML view. With this in mind, I think that QT purposely disabled the msgbox function and some other functions.

I'm not sure why the WshShell.Popup function doesn't work, but I'd say that somehow it follows the same principle above.

Not applicable
Author

Hi Fernando,

    I tried something else. I am displaying a textbox with a msg to replace the popup. That works on the browser. But, now , I am facing a different issue. The text box is displayed if I call it independently.

But, If I give it after the command,

Set WSHShell = CreateObject("Wscript.Shell")

     WSHShell.Run("D:\testserver.bat")                

     ActiveDocument.GetApplication.WaitForIdle 3000

     ActiveDocument.Variables("vReloadStatus").SetContent "1", true // the text box display is conditional .

the text box is not displayed.Maybe, its because control goes out of qlikview?

The content of testserver.bat is

"C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe" -r="C:\QlikViewMount\RN60-ConsolidatedCostofProgrammingReport.qvw"

Is there any way I can include the batch file command in the macro itself in WSHShell.Run()?Then, the text box might be displayed? I guess its possible, but I am not getting the syntax right!

Could you help me out here please?

Thanks and Regards,

Anju

fosuzuki
Partner - Specialist III
Partner - Specialist III

Try this:

dim strCommand

dim strReturnValue

strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe"  & chr(34) & _

            " -r=" & chr(34) & "C:\QlikViewMount\RN60-ConsolidatedCostofProgrammingReport.qvw" & chr(34)

Set WshShell = CreateObject("WScript.Shell")

strReturnValue = WshShell.Run (strCommand, 0, true)

I think that your code isn't working because the ActiveDocument.GetApplication.WaitForIdle will not work in AJAX, just like the msgbox function.

Not applicable
Author

Hi Fernando,

Its working !! .. Thanks a lot!

This is how the final macro looks.

Sub External

    Set WSHShell = CreateObject("Wscript.Shell")    

     dim strCommand

    dim strReturnValue

    strCommand = chr(34) & "C:\Program Files\QlikView\Publisher\Distribution Service\QlikviewDistributionService.exe"  & chr(34) & _

" -r=" & chr(34) & "D:\DICE\PSReports\reloadvictim.qvw" & chr(34)

Set WshShell = CreateObject("WScript.Shell")

strReturnValue = WshShell.Run (strCommand, 0, true)

ActiveDocument.SetClearState 'refresh the document so that reload changes are visible immediately

ActiveDocument.Variables("vReloadStatus").SetContent "1", true 'set variable so that text box is displayed

End Sub