Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
For general understanding I have writen a macro which is to be executed at several locations.
My macros name is TestMyFunction.
If I click on a textbox with my macro configured on the action "execute macro", all is running fine.
But when I execute the macro in the script, qlikview closes without any trace.
Here the script code
let Dummy1 = TestMyFunction();
Here the macro:
function TestMyFunction
set ActQvDoc = ActiveDocument
dummy = ActQvDoc.Variables("UserNameOs").SetContent ("Hallo4", true)
TestMyFunction = "Hallo1"
end function
Now how can I debug such a case when QlikView is disappearing as soon as I execute the script?
Thank you
Hi,
I don't believe that you can interact with the ActiveDocument like this from within the script. There have been restrictions on it in recent versions.
What, exactly, are you trying to achieve?
Stephen
Hi,
you can modify the function as and then call this on a Button click
let Dummy1 = TestMyFunction();
Here the macro:
function TestMyFunction
set ActQvDoc = ActiveDocument
dummy = ActQvDoc.Variables("UserNameOs").SetContent ("Hallo4", true)
Msgbox dummy 'This will give you value of Variable
TestMyFunction = dummy
end function
Also there is a Debug button given in Macro editor. you can use that.
Hello
This method do not work for debugging as QV is obviously dying at the statement
dummy = ActQvDoc.Variables("UserNameOs").SetContent ("Hallo4", true)
Thanks Valerio
One way for a macro to set a variable from in a load script, without using ActiveDocument:
LET UserNameOs=TestMyFunction();
where the macro is:
Function TestMyFunction
TestMyFunction = "foo"
End Function
If you need to read a variable value in the macro, you'll have to pass it as a parameter:
LET vX = 1;
LET vY = addTwo($(vX);
where the macro is:
Function addTwo (input)
addTwo = input + 2
End Function
-Rob