As it can be seen in the other posts concerning this topic,
since QlikView Version 10.0 there is no longer any debugging functionality for VBScript in Qlikview.
And it seems that QlikTech is not willing to integrate debugging tools in the near future
Without a debugger writing VBScript Code can be very hard.
Therefore I tried another approach: Why not use the integrated debugger in Microsoft Excel?
To be able to debug via Excel I took the following steps:
- I installed the QlikView Plugin (which is also needed for the enhanced WebView of QlikView in the IE)
- I created a new empty Excel document and copied all the VBScript Code that I want to debug from QV into an Excel VBA module
- In order to communicate with QlikView I added the following references to the VBA project (they should be simply selectable when the plugin is installed):
- QlikOCX ActiveX Control module
- QlikView 11.0 Type Library
- Due to small incompatibilities between QV and Excel VBA some minor code adaption have to be made
- Global variables may not be initialised outside a Sub or Function in Excel. Therefore I have to change my script to only declarare global variables, and to move all Initialisation to a newly created Sub init(), which I have to call before I start the actual debugging
- If I want to call a Sub or Function in QV I only need to write "function_abc(var1)". In Excel VBA I need to change that to "CALL function_abc(var1)"
- I created a new Sub Debug() that I use to debug the QV code:
- Call Init() 'Initialise global variables
- Set qvApp = New QlikView.Application 'gives you access to QV. If you have more than 1 QV instances opened, the last opened is returned
- Set qvDoc = qvApp.ActiveDocument 'gives you access to the QV ActiveDocument. In your QV script you have to replace every usage of "ActiveDocument" by the variable qvDoc, which references the active document!
- Call qv_function_you_want_to_debug
- At last I created a button in Excel and linked its click event to the Debug() procedure
After all this steps the Excel debugger can be used and everything works quite well. The need to adapt the code is a little drawback, but If you try to design your initial QV code according to the Excel incompatibilities, then this is no big deal.
Has anybody else experiences with a debugging solution? Do you think the solution described is useful or do you have any suggestions or enhancements?
I'm looking forward to any comments :-)