Is possible make macros that run server-side?

Well, the truth is that it seems a simple question but it is quite difficult to answer, even certified developers have assured me that macros are ALWAYS on the client side only.

Based on this definiciíón macros are very limited to automate some tasks client-side as long as security settings and / or the type of client permit, what is almost useless …..

Interestingly there are a couple of check boxes in the console QEMC on QVS,  tab “Security”   at least arouse curiosity about the meaning of their existence:

When one begins to search for information in the forums and the QlikView’s official blog there are a lots of questions and answers, many in tone in which macros can not run server side, others work only in some cases and as many unclear responses that only contribute to confusion.

The truth is that I have’nt  still completely clear on the context and situations in which macros run Server side so I’ll just let my experience and the steps to reproduce It.

1 – First you must enable in QEMC checkboxes that allow macros to run on the server side, as seen in the previous screen.
2 – Then create a qvw file with a button and associate It with the click of a macro:

In the editor select the  security level that’s required: “System Access” and “Allow Access System”:

Add the follow code for the macro:

Sub Prueba_Macro  'Macro Test

Const ForAppending = 8
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("C:\TestServerSide.txt" ForAppending, True) 'Create a file on disk c:\ in where you are running (client or server)

    objTextFile.WriteLine ("test text line 1") 'We add text to the file
    objTextFile.WriteLine ("test text line 2")

objTextFile.Close 'We closed the and save the file

Set objfile = objFSO.OpenTextFile ("C:\TestServerSide.txt", 1) 're-open the newly saved file for reading

Do Until objFile.AtEndOfStream 'read the file contents
    strCharacters = objFile.Read (1)
    text = text + strCharacters

Set objTextFile = objFSO.OpenTextFile _
    ("C:\TestServerSide2.txt" ForAppending, True) 'Create a second text file in c:\

    objTextFile.WriteLine (text) 'We recorded what we read the in first file

end sub

3 – Finally recorded our qvw and publish it on the server.

4 – Then access to the Access Point of your server and using client AJAX (it does not work with IE Plugin, at least with this configuration) access to the application you just created.

By pressing the button on the client does not observe anything, but if you go to C: \ drive on the server side you’ll see that the files were created there, which means that the macro was executed server-side (you must ensure that the login used to access the application must have read-write permission in the destination folder, in the example C:\).

One of the problem with this is that if within the macro put a “msgbox (” Successful recording “) (eg) to give feedback to the user, the macro will stop working because it is set will to run on the server and this is a  unattended server-side run so that no one  will click on “Ok ” pop-up’s button.

To give some kind of user feedbak we can add a second action of the type “External / Set variable” and assign a value “true” to a variable used to display a text item conditionally hidden where we display a message indicating the result of the action.

In conclusion: YES, macros server-side work, and certainly the developers did not put QlikTech’s settings configuration (run macros in server) just to “do marketing”.

If there is no clear documentation you must “test” what instructions do work and which are’nt,  understanding that it’ll be unattended execution with little feedback, but it is an excellent functionality to extend the limitations and expand areas of use of QlikView .

I hope you found it usefull, and until next time !


Acerca de pparnisari
Casi 44 vueltas al sol. Licenciado en sistemas. Curioso, investigador, excelente para resolver problemas prácticos. Casado, 2 hijos, cada vez con mas preguntas y respuestas mas en duda. Almost 44 laps to the sun. System engineer. Curious, researcher, great for solving practical problems. Married, 2 children, each time with more questions and more answers in doubt.

5 Responses to Is possible make macros that run server-side?

  1. Barry says:

    Hi Pablo,

    Nice article. QlikView can indeed run macro’s fine on the server-side. I’ve used the ServerSideExportEx method in the past to enable writeback, much like you’ve described in your earlier post.

    Kind regards,

    • pparnisari says:

      Yes, but ServerSideExport (if I’m not wrong) run Cliente-Side and thru a QVS functionallity serialize the data and save it on server. Because this is possible save a user side table (chart) on the server.
      But if you enable macros to run on server side all the script will run completly on server side and you won’t acces cliente side data anymore.
      All this must be tested to be completely sure.


  2. Profesorado says:

    hola como puedo editar un grafico en qlikview server? saludosssss

  3. Raul Alberto Marquez Zamora says:

    Yo tengo una duda un poco mas Begginer, tengo creado un macro, pero solo se activa al momento de en el boton ‘Editar Modulo’ cuando Verifico, pero cuando quiero utilizar el Macro desde un boton utilizando ‘jecutar Macro’, este no funcion, llevo 10 horas en qlikView y estoy asombrado de su facilidad de interaccion, gracias de antemano!

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: