Wednesday 18 September 2013

SSRS Expressions


Lets look at a very simple example.

Step 1: Create a report server project and connect to Adventure Works Database. 
Step 2: Add the SalesOrderDetail table with a couple of columns to the Report.



Step 3: In the toolbox, add the table control to the report.


Step 4: Add 3 columns to the report - SalesOrderID, SalesOrderDetailID, OrderQty, LineTotal.




Step 5: Now lets write some expressions. We will display anything in LineTotal cell as Green, if the number is above 2000, else we will display in Red.
Right click on the cell , and select text-box properties.



Step 6: Next to the colr dropdown, there is an Fx button.
Write the below expression.




Step 7 : Click OK and then on the Preview button.
You should be getting the final output as displayed below.



Step 8: Now lets write some expressions to manipulate some data.
Right click on the OrderQuantity Cell and click on expressions.
Enter the below expression and click OK.



Step 9: Click on the preview tab, you should get the below output.




I have demonstrated a very simple use of expressions. However , you can write very complex expressions depending on your business needs. For instance, you can write expressions, to calculate the standard deviation of so and so , and manipulate results accordingly.

No comments:

Post a Comment

EMP, DEPT Sample script

/****** Object:  Table [dbo].[DEPT]    Script Date: 19-05-2016 06:58:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET A...