Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

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.

View solution in original post

4 Replies
sunny_talwar

tamilarasu‌ would you be able to advise on this

tamilarasu
Champion
Champion

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.

Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

Thank you Sunny