Showing posts with label SSRS 2008. Show all posts
Showing posts with label SSRS 2008. Show all posts

Friday, May 15, 2015

SSRS: Change Font and Background Color at Run time


SSRS: Change Font and Background Color at Runtime.

Sometimes Clients requirements are very unexceptional but we need to fulfill them. So the requirement is that Client could change the Font properties as per their will like they can change “Font Family, Font Size, Font Style and Background Color of Tablix Header” at any time.

So if N numbers of reports are deployed then “How do you do it”? Solution is given below:

Create a table in Database like Font_Table or whatever the name you want to give. Add columns like: Font_Family, Font_Size, Back_Color etc. Insert only one row in table, if you need more values then add columns but insert only single row as below:

CREATE TABLE FONT_TABLE
(
Font_Family  VARCHAR(50),
Font_Size   VARCHAR(10),
Back_Color   VARCHAR(10)
)

INSERT INTO FONT_TABLE VALUES
('Calibri', 10pt, 'GREEN')


SELECT * FROM FONT_TABLE




NOW, we can use this table values in our SSRS report’s properties. We can write expression of Font Properties and many others as well.
Add new dataset in report. Add query “Select * from Font_Table”


Go to table header -> Properties -> BackgroundColor -> Expressions -> Choose color field as below:


For Font Family:
   




Do it same for Font Size, Font Weight etc.
See the output:




NOW if I change the values in my Font_Table in database and just refresh the report, you will see the difference:

UPDATE FONT_TABLE
SET Font_Family = 'Verdana',
      Font_Size = '12pt',
      Back_Color = 'Orange'







So you can change any property at runtime which having expression functionality and also we can use RGB Code for Color property instead of writing color name. If you use this property at the time of developing reports then all reports will be effected. Enjoy and let me know for any question. Thanks.

Wednesday, July 31, 2013

SSRS - Unchecked some values by Default from Multiple Value Parameter

SSRS - Unchecked some values by Default from Multiple Value Parameter.

There was one requirement in SSRS that Client wants to select some values in multiple value parameter by default but they need the functionality to see all values in same parameter. For example please have look in below screen shot..

here client wants to unchecked Afghanistan and Albania (marked in Red) by default but they want to see these values in parameter so that in future they can run report for Afghanistan and Albania by selecting these values. For these such type of functionality I tried a scenario as below:

Step-1
Make connection with AdventureWorks Database..

Step-2
Add Dataset1 in SSRS with SQL - select * from Person.CountryRegion.

Step-3
Add Dataset2 in SSRS with SQL - select * from Person.CountryRegion
where CountryRegionCode not in ('AF','AL','AQ') -- it will filter some countries like Afghanistan, Albania.

Step-4
Add Parameter "Counrty" select allow multiple values:


Step-5
Go to Available Values and choose Dataset1 for values from Query:


Step-6
Go to Default Values and Choose DATASET2 for values from Query:


Click OK..

Run the Report and you will get parameter as below:



Thanks ..