Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding radio button

Dear All,

Can anyone suggest me how to use radiobutton for a particlar chart in qlikview. As........................

if we have two option in radiobutton:1) Report 1 2) Report 2

If we select 'Report 1' from radiobutton then it will display chart no 1 and if we select 'Report 2' it will display chart no 2.

is there any macro or something else......................

Plz suggest me ASAP

11 Replies
Not applicable
Author

Hi,

In Qlik View we don't have Radio Button. But you can make it using list box.

Steps 1:

Make List box and the load you fields and the go to Properties and then "Presentation" tab.

Then select "Selection Style Override" -->"LED"

Then Goto "Caption" --> un check the "Show Caption" Option.

Now your list box will look like "Radio Button".

Step 2:

Declare one variable in the qv document. in my sample i have created "GetShowValues"

Step 3:

Write the below Macro in your qv document.

Sub GetVal
Set Val=ActiveDocument.Fields("Name").GetSelectedValues
Val1 = Val.Item(0).Text
ActiveDocument.Variables("GetShowValues").SetContent Val1, True
End Sub

Step 4:

Goto "Setting" --> Document Properties-->Macro tab.

Then in the "Field Event Triggers" "Select your List box Filed"

Then in the right hand side select "OnSelect" event you can select the macro "GetVal"

Step 5:

Goto Chart1 Properties -->Layout--->Show Conditional -->

Give the =GetShowValues='Report1'.

Step 6:

Goto Chart2 Properties -->Layout--->Show Conditional -->

Give the =GetShowValues='Report2'.

Now according to your selection in the list box the chart will be displayed.

See the attached sample document.

Thanks

Saran.

Not applicable
Author

Hi,

You can archive this with out using macro also.

Change the following settings in the chart Properties.

Chart 1: "Show Conditional" Put like this "=getfieldselections ( Name )='Report' "

Chart 2 :"Show Conditional" Put like this "=getfieldselections ( Name )='Repor2' "

This will also works.

Thanks

Saran.

johnw
Champion III
Champion III

You don't need a macro AND you don't need getfieldselections(). Just use =Name='Report1'.

Anonymous
Not applicable
Author

If your priority is how it looks, then filed Name in style LED makes sense. If the exact presentation doesn't matter, you can use an input box with variable Name with predefined values Report 1 and Report 2, and with drop-down select. This way you don't need additional fields. All the rest is the same.

johnw
Champion III
Champion III

Is there an advantage to using a variable with two values instead of a field with two values? I've always preferred fields to variables, but I want to make sure I'm not missing something. Either approach works, of course.

Anonymous
Not applicable
Author

John,
I prefer not to create unnecessry fields, if possible, to keep data model cleaner. And, the property "Always One Selected" which is necessary here for the field sometimes may disappear on reload. Nothing can happen to the variable. And you don't need to reload when you want to make a change.
The advantage is not that big, as I can tell. More like a matter of preference.

johnw
Champion III
Champion III

Good points, particularly regarding the reload. That's been trouble for me a few times when I was playing with my "not related to the real data" fields in some of my bigger applications. And while I think I've only lost my "always one selected" on one occasion, it seems like a pretty big problem for a lot of people.

Not applicable
Author

Hi Saran,

I got ur test qv file and apply it at my original application

it will work thanks a lot for ur support

Neetu Singh

userid128223
Creator
Creator

what if you had to do exact same thing but show and hide data within a straight table. I have date 1 and date 2 as criteria.

1) i will create new inline table with 2 fields: date 1 and date 2

2) create listbox and turn it into checkbox, link it to newly created table field called Date1 & Date 2

How can I now show and hide within list box date1 data or date 2 data, based on above selection.