Use of macros in QlikView applications should always be limited and only be used as a last resort for the following reasons:
- Running macros may have a large negative impact on performance in a client or on a server. Macros automatically deletes the client cache, therefore it increases the chance of conflicts between cached and modified states. As a result the client or server may hang or crash.
- Macros are executed at VBScript (VBS) level while QlikView in general is executed at assembler level which is thousands of times faster by default.
- Macros are single threaded synchronous as opposed to QlikView which is asynchronous and heavily threaded and this causes the macros to interrupt all calculations and may lead QlikView to freeze.
- Macros always have a poor performance which makes them less desirable from a performance point of view.
- Macros are always secondary when it comes to QlikView functionality. First, all internal basic QlikView functions are run and tested and thereafter the macros are run and tested
- Macros require constant maintenance. Applications need to be revisited with each new version of QlikView to guarantee that the macros are not impacted by any structural changes.
- Only a subset of macros will work in a server environment with clients (IE Plugin, Ajax, QV Mobile ) since local operations (copy to clipboard, export, print etc.) are not supported, though some of these have a server-side equivalent (e.g. Server-SideExport etc.) where each client impacting on the server performance in a negative way.
The table below shows the clients that support running macros:
|OS / Clients||OCX (Active X)||Ajax ||QV Mobile ||IE Plug-In|
|IOS|| ||X|| || |
Macros may work with a few thousand records and not necessarily scale well. The problems may become more serious when larger datasets are involved. It is also important to note that certain events can only be captured through the use of macros and for this reason it may be difficult to avoid macros altogether. Qlik always strives to incorporate as much of this functionality as possible as basic QlikView functionality, thus limiting the use of macros in the long run. Given all of the above, macros cannot be part of any recommended QlikView design pattern.
Please note, VBScript is deprecated in Internet Explorer 11 and no longer supported in IE11 edge mode
.More details can be found from these links.