Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
chris_johnson
Creator III
Creator III

Macro not running in task

Hi,

I've been having a problem (which seems to have been happening since updating to QV Nov'17 version) with running a macro. There is a macro that does some text encoding on running of the scheduled task, does not access the file system, but will only run when ran on QV Desktop not in the QV Server.

I have checked in the QMC and macro execution is allowed (although unsafe macros is not ticked).

I don't understand why the macro will not run when the server runs the task.

Anyone have any ideas?

Thanks

1 Solution

Accepted Solutions
marcus_sommer

If I understand this routine right it adjust an invalid url through replacing invalid chars into a valid url. Something like this could be done with a mapsubstring() like in this example:

Re: Passing parameter strings that contain special characters

- Marcus

View solution in original post

11 Replies
rubenmarin

Hi Adam, there is a list of macro limitations in server:

Using Macros in QV Documents on the QV-Server ‒ QlikView

Maybe is using OnPostReload trigger?

marcus_sommer

AFAIK as a general rule no macro won't be executed by directly reloading an application through a qmc-task or starts the qmc-task an external batch/task? Are you sure it had worked before QV Nov'17?

- Marcus

chris_johnson
Creator III
Creator III
Author

It did work before the latest QV Nov'17 release, although I know that could be a coincidence. We had to upgrade due to a few other issues so could be something unrelated.

chris_johnson
Creator III
Creator III
Author

This is the VBScript function by the way:

Function URLEncode(ByVal str)

Dim strTemp, strChar

Dim intPos, intASCII

strTemp = ""

strChar = ""

For intPos = 1 To Len(str)

  intASCII = Asc(Mid(str, intPos, 1))

  If intASCII = 32 Then

   strTemp = strTemp & "+"

  ElseIf ((intASCII < 123) And (intASCII > 96)) Then

   strTemp = strTemp & Chr(intASCII)

  ElseIf ((intASCII < 91) And (intASCII > 64)) Then

   strTemp = strTemp & Chr(intASCII)

  ElseIf ((intASCII < 58) And (intASCII > 47)) Then

   strTemp = strTemp & Chr(intASCII)

  Else

   strChar = Trim(Hex(intASCII))

   If intASCII < 16 Then

    strTemp = strTemp & "%0" & strChar

   Else

    strTemp = strTemp & "%" & strChar

   End If

  End If

Next

URLEncode = strTemp

End Function

marcus_sommer

Please provide some more informations if the qvw is directly reloaded or per external batches and how the macro is triggerred and how it does look like.

Further there was various changes on the security-settings between the releases especially if the old release was an early QV 11 then there was many changes to the current release.

- Marcus

chris_johnson
Creator III
Creator III
Author

Hi Marcus,

I posted the macro function itself to the post but it is still being moderated.

The previous release was version 12 SR 1.

The macro is triggered via a line in the script:

let urlEncoded = URLEncode('$(url)');

where url is the url for what I need to reference (a Google Analytics address) and URLEncode is the VBScript funtion

marcus_sommer

Ok. it's a function My using of vbs-functions during the load was along time ago and probably before we extended our solution to a server-environment. Therefore I'm not really sure but if you say it worked I think vbs-functions are executed as long they not trying to access the ActiveDocument.

Therefore I could imagine that some security-setting within the settings.ini is now per default different as before but I don't know which one. It's not directly related to your case but similar from (il)logic of changing settings and may help you to get ideas: QV 12.10 “Can Execute External Programs” is back | Qlikview Cookbook.

If your vbs-routine isn't too complicated you could try to switch it into a qlikview-variable and/or a sub-routine.

- Marcus

marcus_sommer

If I understand this routine right it adjust an invalid url through replacing invalid chars into a valid url. Something like this could be done with a mapsubstring() like in this example:

Re: Passing parameter strings that contain special characters

- Marcus

chris_johnson
Creator III
Creator III
Author

Hi Marcus,

I switched it to script using the mapsubstring() function as you suggested (link to example I used: String manipulation)

Thanks for your help