Home > SSRS > Expressions in Reporting Services

Expressions in Reporting Services


Introduction
Expressions are very useful feature in building corporate reports. It helps to build report with dynamic data.
In this article we are going to see how we can use URL’s in reports with the dynamic URL variable using report expression.
In Action
Scenario
A large enterprise having a web server and maintaining a list of most valuable customers list and their web links in a table to do a routine check for availability. We have Microsoft SQL Server Database with a table named CustomerURL.
—Create database
CREATE DATABASE [TestDB]
GO

–Create table
CREATE TABLE [dbo].[CustomerURL](
[id] [int] IDENTITY(1,1) NOT NULL,
[URL] [varchar](50) NULL
) ON [PRIMARY]

GO

–Insert values
INSERT INTO [TestDB].[dbo].[CustomerURL]
([URL])
VALUES
(‘www.microsoft.com’),
(‘www.msdn.com’),
(‘www.sqlcat.com’),
(‘www.SQLServerRider.wordpress.com’)
GO

Building reports
I assume readers are having basing knowledge of creating reports and browse them. I switch to the actual scene.
We should place Table control in the data region.

If you view the report you cannot see the hyper link. It does show you as a normal tabular data. We have to change the properties of the data cell of the table control.

Now, right click on the URL data cell and select Text Box Properties.

In the textbox properties, Select Action and in the right hand side select Go to URL option, select the URL Field in the combo box.

Write expressions in the Expression box. Click the button next to the combo box.

Fill the value http:// and it should look like this = “http://” & Fields!URL.Value. Click OK now. Preview the report

Your will see the report like this. After textbox property setting URL has been changed the internal link value which will be used to open in the web browser (Internet Explorer).

But, we also need to change the display to give more meaning to the report data.

To concatenate “Http://” value with the URL, Go to textbox properties again and then click the button next to the value textbox. Now, fill the value as you did in the Go to URL value.

Then click the Function button next to value combo box on the right side.
Browse the report now. You will see the report screen as given below.
Advertisements
  1. subbareddy
    June 20, 2011 at 8:36 am

    hi
    how can i set each page having 20 rows

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: