Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

anuragsapanbhar
New Contributor III

Call Script Function From Macro

Hi,

I am not sure if I am repeating the question, but tried searching the solution in forum could not find it.

Can any one help me on how I can call a Sub from load script from Macro.

For example in the Script Window I have this Sub

//In Script Window

Sub Test
let vr='Test Run'; // this is just for example, but originally some calculation to be done in the script

End Sub

Now I have a button where I have assigned an action to call a macro. Can I call the above sub with that macro?


I tried like below

'***In Macro Window ****

Sub CallFunctionFromScript()

Call Test

End Sub


But its not working, Every time I click the button the Macro window opens and stops, obviously I am missing something here.


Please help.

Tags (2)
1 Solution

Accepted Solutions

Re: Call Script Function From Macro

Hi Anurag,

I am not sure what is the purpose of your requirement. You can simply implement the calculation in macro itself ??  If you could explain the reason behind your requirement, we may suggest a better solution. But I don't want to disappoint you. Have a look at the attached file. If your file is a desktop application (reloading application from access point through button click will not work) then below attached file should work. Let us know.

4 Replies

Re: Call Script Function From Macro

tamilarasu‌ would you be able to advise on this

Re: Call Script Function From Macro

Hi Anurag,

I am not sure what is the purpose of your requirement. You can simply implement the calculation in macro itself ??  If you could explain the reason behind your requirement, we may suggest a better solution. But I don't want to disappoint you. Have a look at the attached file. If your file is a desktop application (reloading application from access point through button click will not work) then below attached file should work. Let us know.

anuragsapanbhar
New Contributor III

Re: Call Script Function From Macro

Thank you Exactly what I wanted.

But to explain the requirement in detail, I have a data table holding data for several months Column wise. In another table I have Exchange rates for various month for different countries.

Data Table

   

CountryProductJANFEBMAR
C1P1469
C2P1787
C3P1674
C3P2646
C4P1665
C4P2654
C4P3474

  Exchange Rate  

CountryJANFEBMAR
C1946
C2765
C3868
C4876

What I am tyring to do now is to create another temp table based on my exchange rate month selection. I need standard rate to be applied. If I have selected MAR, then in Jan data also the match value to be applied.

So I needed an action where I can trigger a script to do that.

anuragsapanbhar
New Contributor III

Re: Call Script Function From Macro

Thank you Sunny

Community Browser