Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assigning macro variable to qlikview variable.

Hi Stefan Walther

Hi,

    I wrote the macro code for a button to get the current selection in listbox .Like this

SUB GetSelectedValues

SET id= ActiveDocument.Fields("V_Id")

SET selection = id.GetSelectedValues  
if selection.Count=1 then

      msgbox(selection(i).Text)     

      end if             

END SUB


When I click the button ,I need to store the macro variable ( selection) to a qlikview variable which I'll use later in load/select query in  edit script.For example if I assigned the macro variable (selection) to a qlikview variable(say 's'),then the select query would be like this.

select  * from table1 where V_Id=$(s);

suggest me a correct prodecure in assigning macro variable to qlikview  variable.

         Please help me in solving this.Thanks!!

4 Replies
PradeepReddy
Specialist II
Specialist II


I think no need of writing a macro for this. we can use the function... GetFieldSelections(Field_Name).

I am assuming that, you need to get the current selected value in the variable.

Not applicable
Author

After selection of any value I need to click the 'submit' button.After that only the selected values get assigned to qlikview variable.Then I need to use the variable in where clause like this

                   select  * from table1 where V_Id=$(s);

I don't have any idea of using the  GetFieldSelections(Field_Name) in button properties.hence I went for macro

PradeepReddy
Specialist II
Specialist II

We can  set a variable using button actions. Here is  the process..

Button Properties--> Actions --> Add -->  External --> Set variable --> Ok

Varaible : Variable Name

Value : value need to be assigned to the variable.. we can use  GetFieldSelections(field_name)  function here.

Thanks,

Pradeep

Not applicable
Author

Hi Pradeep,

I done as you said.getting the error like thisbutt.PNG.png

          load.PNG.png

exec.PNG.png