Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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?
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
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.
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
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
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
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
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
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