Thursday, 17 April 2014

Expressions in SSRS


To write expressions in SSRS Reports Right click on text box of column and select Expression ..
Here are the some important Expression that are used in Real Time Scenarios..

1.Expression for Page Number like page number of total pages for ex 1 of 4,2 of 4 etc

="pages" & globals!PageNumber & "of " & globals!TotalPages

2.Expression for Date column format 

=Format(Fields!column .Value,"mm-dd-yy")

 3.how to display 0(Zero) instead of NULL in ssrs reports


In SQL Server we can write query like select Isnull ("columnname",0) 
=iif(isnothing(Sum(Fields!SalesAmount.Value)),0,Sum(Fields!SalesAmount.Value))
4.expression provides the name of the report and the time it was run. It can be placed in a text box in the report footer 
=Globals.ReportName & ", dated " & Format(Globals.ExecutionTime, "d")
5 When a page break is defined for the group, this expression results in a page break every 25 rows.
=Ceiling(RowNumber(Nothing)/25)
6.when used in the Color property of a text box, changes the color of the text depending on the value of the Profit field
=Iif(Fields!Profit.Value < 0, "Red", "Black")
7. when used in the BackgroundColor property of a report item in a data region, alternates the background color of each row between pale green and white:
=Iif(RowNumber(Nothing) Mod 2, "PaleGreen", "White")

8. when used in the BackgroundColor property of a report item in a data region, alternates the background color of each row between green and Orange and Red(if it is more than  2 condition ,we can use Switch ):
=Switch(ReportItems!Textbox75.Value>0.9, "Green",
ReportItems!Textbox75.Value >0.7, "Orange", ReportItems!Textbox75.Value <=0.7, "Red")


No comments:

Post a Comment