In Qlik View we don't have Radio Button. But you can make it using list box.
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".
Declare one variable in the qv document. in my sample i have created "GetShowValues"
Write the below Macro in your qv document.
Val1 = Val.Item(0).Text
ActiveDocument.Variables("GetShowValues").SetContent Val1, True
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"
Goto Chart1 Properties -->Layout--->Show Conditional -->
Give the =GetShowValues='Report1'.
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.
Test.qvw 114.7 K
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.
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.
Test.qvw 114.8 K
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.
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.
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.
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