Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

A macro does't run in the web version

Hello,

I have done a macro which runs correctly in the desktop but it doesn't in the web version.I suppose that I should change the security set up in the server. Does anyone knows a document that gives an introduction to change the server set up?

Thanks in advance,

5 Replies

Re: A macro does't run in the web version

There are quite a few macro functions that will work in the desktop but will not work in the server.

To grant System Access to a macro on server, the setting is in the QMC Server, Security pane: "Allow unsafe macro execution on server".

-Rob

Not applicable

Re: A macro does't run in the web version

Thank you, Rob!

My code is the following, do you know if is something in there that is not helping to run in in web?

Sub ws

  'Create fixed url

  Const HOST = "https://xx.com/xx/cgi-bin/isaweb/me_request.cgi?USER_ID=11&CRC32PWD=2601988992&REQUEST_TYPE=1&SHOT_T..."

  'Obtain dynamic url

  set fld = ActiveDocument.GetField("generated_url")

  me_url = ActiveDocument.Evaluate("trim(generated_url)") ' Get selection

  'Create the xmlhttp object

  Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

  'Call HTTP with the method "GET" enviando url generado

  xmlhttp.Open "GET", HOST & me_url, true

  xmlhttp.send ""

  msgbox("ZIP Descargado")

  'Create temporal file to save the xml

  Path = ActiveDocument.Evaluate("left(DocumentPath(), index(DocumentPath(), '\', -1))")

' FileName = Path & "XMLOutput.xml"

  FileName = "XMLOutput.xml"

  set fso = CreateObject("Scripting.FileSystemObject")

    set s = fso.CreateTextFile(FileName, True)

  s.writeline(xmlhttp.responseText)

  ActiveDocument.Variables("request_me").SetContent xmlhttp.responseText,True

  APPLICATION.SLEEP(100)

    s.Close() 

end sub

Thank you in advance

Re: A macro does't run in the web version

You will need System Access for this macro, so you will need to set the "Allow unsafe macro execution on server" in QMC.

I've never tried to write to the filesystem from a server macro, so I don't know if that will work. Perhaps someone else can confirm.

I can see at least one problem. On the server, "DocumentPath()" returns the document URL, not a filepath.

Are you launching this macro from a user button click?

hirishv7
Honored Contributor

Re: A macro does't run in the web version

Hi ,

Check this,


In the server environment, some macros will not work, according to its design. Anyway, there are two points worth noting:

  1. Make sure you are granting System Access to your macros in the server through QEMC (System, Setup, QlikView Servers, expand and click, Seucrity tab in the right pane "Allow unsafe macro execution on server" and "Allow macro execution on server" ticked) and in the Macro editor, (Ctrl + M, bottom left drop downs)
  2. If they are creating some filesystem object (such an excel file) make sure you are using the IE Plugin.

HTH,

Hirish

Not applicable

Re: A macro does't run in the web version

Rob,

Yes, I am launching the macro from a user button clic.

Thank you for the advise about the DocumentPath.

Community Browser