Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dbouilleux1
Partner - Contributor
Partner - Contributor

How can I retrieve the text of a button ?

Hello,

I am new to Qlikview and therefore have lots of questions ...

How can I retrieve the text of a button in an action associated with the button?
I want an action button to initialize the value of a variable with this text ...

Thank you for your help ...

Denis

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei

i bulit a new macro Base on the precious Example

look at macro Getbutton 4

you can use it on all buttons

View solution in original post

11 Replies
Not applicable

Hi ,

What i understand from your question is to set a value for variable by clicking on button.

Whether it is correct or not ?

Regards

Venkat

dbouilleux1
Partner - Contributor
Partner - Contributor
Author

It's correct...

Denis.

gandalfgray
Specialist II
Specialist II

Hi

I would first create a variable which I would use as the Text of the button.

Here is an example:

I would start with this statement in the Load Script:

Let vButtonText = 'State 1';

In the GUI I would do like this for the button, first set the text:

buttontext.JPG

Then I could use it like this (toggling between two texts)

togglebutton.JPG

Then I could do all sorts of things depending on the value of vButtonText.

hth

dbouilleux1
Partner - Contributor
Partner - Contributor
Author

Thank you for your response, GandaldGray, but it does not match my use case.

I have a set of buttons, each with their name and I want to get in a variable the text of the button that was clicked.

Denis

gandalfgray
Specialist II
Specialist II

Hi dbouilleaux

Then you could simply add an action for each button setting the variable you want to be set to the text of the button.

abutton.JPG

hth

Not applicable

Hi

First Create a Variable 'vText' from Document Properties.

Now Create a button, then Go to the Actions Tab .

In Add Action -> External -> Set Variable .

Provide your variable in Set Variable and below to that give 1 and click on ok.

After clicking the button the variable 'vText' will be assigned to 1.

vText1.PNG

vText2.PNG

Regards

Venkat

Not applicable

Hi,

Please find the attached sample may help you.

Cheers.

dbouilleux1
Partner - Contributor
Partner - Contributor
Author

Thank you, Blackrock, for your answer.

Your solution would be ideal if I could access the Id of the button clicked ...
What I seek in fact, is a generic macro that I could use all my buttons and avoid one-button macro ...

Denis

lironbaram
Partner - Master III
Partner - Master III

hei

i bulit a new macro Base on the precious Example

look at macro Getbutton 4

you can use it on all buttons