Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

anuradhaa
Contributor

Get user input values and assign that to variables using macro

Hi

I want to create a button as "Set variable Value" then once user click it it has to display a pop up and user can input values.

after he input that value has to assign to a variable.

can i do this using macro?

Thanks

1 Solution

Accepted Solutions
Employee
Employee

Re: Get user input values and assign that to variables using macro

I still claim that you should avoid macros. And you should use an Input box. A pop-up is not easier for a user to manage.

You can do it the following way:

1) Use an Input box for your vSales variable.

2) Goto Document properties - Triggers

3) Mark your vSales under "Variable event triggers"

4) Add Action "Select in field" and add the appropriate search string.

HIC

Image3.png

7 Replies
Highlighted
Employee
Employee

Re: Get user input values and assign that to variables using macro

No, you shouldn't do it that way. Macros are bad.

Instead I suggest you use an Input box. It is designed to do exactly that; to let users set variable values.

HIC

anuradhaa
Contributor

Re: Get user input values and assign that to variables using macro

Currently i'm using input box but i have some problems,

see i have sales field,

Then in my input box i take vsales,

then based on that value i have to select all the sales grater than vsales and adjust whole sheet based on that selection criteria. but currently it don't happen. i have to select all sales after set vsales value.

Also inputbox UI editing is difficult. If you can pls send me a doc to learn input box UI enhancements. Also please give me a suggestion to my question

Thanks

Re: Get user input values and assign that to variables using macro

Hi,

look at the attached application.

Hope it helped.

Note

In-order this to work you must at-least select one value from the list box.

Regards

ASHFAQ

anuradhaa
Contributor

Re: Get user input values and assign that to variables using macro

Thank You for you help, but i can't use predefined values

Employee
Employee

Re: Get user input values and assign that to variables using macro

I still claim that you should avoid macros. And you should use an Input box. A pop-up is not easier for a user to manage.

You can do it the following way:

1) Use an Input box for your vSales variable.

2) Goto Document properties - Triggers

3) Mark your vSales under "Variable event triggers"

4) Add Action "Select in field" and add the appropriate search string.

HIC

Image3.png

anuradhaa
Contributor

Re: Get user input values and assign that to variables using macro

Grate That works.

Could you please tell me is there a way to reset variable in input box by clicking on a button with out macro.

Note - i want to reset is , not 0. because i have negative values too

Employee
Employee

Re: Get user input values and assign that to variables using macro

You don't need to reset the variable. Just clearing the selection by clicking the clear button in the toolbar will reset the selection.

Alternatively, you can change the variable value to blank in the input box. Or you can create a button with an action that sets the variable to blank.

HIC

Image4.png

Community Browser