Data visualisation is an art and a
science and its primary goal is to communicate information clearly and efficiently via statistical graphics, plots and information graphics.
Sometimes, we really want a checkboxes or radio buttons displayed on a report to full-fill the client requirements .
In our last discussion, we have already
learnt that how to add checkboxes on the report. We will continue with the
previous report and will learn how to add radio buttons in a column on our SSRS
report.
For the better understanding, we will
take an example of week days where current week day should be checked in and
other days should be unchecked in our report. We are going to generate dummy
data by helping of Common table expression feature of SQL as given below:
Use Demo
Go
------ Create on
the fly CTE Table
;with CurrentDay as
(
select NameDay=DATENAME(DW,getdate()),
WeekDay=DATEPART(dw, getdate())
union all
select NameDay=DATENAME(DW,getdate()+WeekDay),
WeekDay=DATEPART(dw, getdate()+WeekDay)
from CurrentDay
----- set weekday
conditions
where WeekDay<7
)
------ Pull Data
From CTE Table: CurrentDay
select NameDay,
WeekDay,
----- set weekday
conditions as 0 and 1
CurrentDay=IIF(WeekDay=DATEPART(dw, getdate()),1,0)
from CurrentDay
order by WeekDay;
|
Now, we have the data table and we want
to display this data on the SSRS report where current day =1 should be checked
in the radio button and current day=0 should be unchecked in the radio button as
given below:
There are very simple instructions to
create this kind of report in SSRS as given below:
In
the SQL Server Data Tools environment, right click on the last column of the
report and add column in left as given below:
After
adding the new column to the report, just put the current day value in the
column and change the column header as Current Day – Radio Button and Preview
the report as given below:
Now we have the report having current day
values as 1 and 0. Now, we want to change these values with radio buttons and
do the following setting against Current Day detail column-
Change font to Wingdings 2 and font size =16
Right click on the Current Day – Radio Button
and click on Expression as given below:
In Expression window, we should write the
following condition as given below:
= IIF(Fields!CurrentDay.Value=1,Chr(158),
Chr(153))
Where,
Chr(158), for a
filled-in Radio Button
Chr(153), for a empty
Radio Button
|
After
putting the conditional settings for radio buttons, click OK button and preview
the report as given below:
We
can do the same setting for background color for the checked and unchecked rows
as given below:
Conclusion
We can generate checkboxes, radio buttons
in the report by doing some additional expression settings on the textboxes and
change font type and font family also. To generate checkboxes and radio buttons
conditional data should be Boolean to write down the simple conditional expression
to avoid the complex conditional expressions.
Very good article. In our SSRS Web Reporting, we show different picture for the value true and false. www.crystalmigration.com
ReplyDeleteIt works fine but not displaying the radio buttons properly in browser. They are rendered as different symbols.
ReplyDeletePretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. https://archerytopic.com/best-long-range-two-way-radios/
ReplyDeleteYou simply direct people to the vendor site. The rest is dealt with by the last mentioned. make money online
ReplyDeleteI truly like your interpretation of the issue. I now have an unmistakable thought on what this matter is about.. radio manual
ReplyDeleteI have recently started a blog, the info you provide on this site has helped me greatly. Thanks for all of your time & work. literature
ReplyDelete