Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nickedw0
Creator
Creator

Call subroutine from button

Is it possible to execute a subroutine from a Button Action? I want to call a subroutine which receives a variable as an argument. (The subroutine manipulates the argument and assigns a value to another variable.)

3 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Hanief,

There's no possibility to call a subroutine from load script into a button, you can only do that with macros in View and than use the macro into the button.

I've made a simple example of macro bellow, that gets the variable vTest and add one to it and puts the result to vTestFinal.

function getVariable

  set v = ActiveDocument.GetVariable("vTest")

  set vFinal = ActiveDocument.GetVariable("vTestFinal")

msgbox(v.GetContent.String)

vNum = CInt(v.GetContent.String)

vNum = vNum+1 ' do calculations here

msgbox(vNum)

vFinal.SetContent vNum,true

end function

Also attached a sample QVW

nickedw0
Creator
Creator
Author

Thank you. This resolved my issue

nickedw0
Creator
Creator
Author

Is there any way to macro using Qlikview script statements? Otherwise I have to convert the code to vbscript