user9273914
user9273914

Reputation: 99

SSRS : How to make a data set field appear in the footer?

I have a simple report with a dataset( Patient id, programid, name, address, phone). In my report footer, I am trying to write a condition where the footer value shouldn't show up for specific program ids. But the report footer doesn't display the dataset fields. How do I write this condition for report footer?

Upvotes: 1

Views: 3644

Answers (4)

M Ramazoodle
M Ramazoodle

Reputation: 3

Page headers and footers can contain static content, but they are more commonly used to display varying content like page numbers or information about the contents of a page. To display variable data that is different on each page, you must use an expression.

If there is only one dataset defined in the report, you can add simple expressions such as [FieldName] to a page header or footer. Drag the field from the Report Data pane dataset field collection or the Built-in Fields collection to the page header or page footer. A text box with the appropriate expression is automatically added for you.

To calculate sums or other aggregates for values on the page, you can use aggregate expressions that specify ReportItems or the name of a dataset. The ReportItems collection is the collection of text boxes on each page after report rendering occurs. The dataset name must exist in the report definition.

For example, to hide or show a logo based on the value of the Customer Type in the dataset, create a Text Box called CustType in the report body, in that Text Box will be your CustomerType field. Then in the header or footer create another Text Box for your aggregate expression like so: =ReportItems!CustType.Value = "Direct"

Upvotes: 0

Sarathi Jayapal
Sarathi Jayapal

Reputation: 300

we can use parameters in footers. you can have a parameter for the specific column and pass the value from code and use the parameter in footer expression like,

           =Parameters!Param1.value

Upvotes: 0

Chris Latta
Chris Latta

Reputation: 20560

Headers and Footers can't display fields from your datasets because the dataset is out of scope for the header and footer - it wouldn't know which row to display the field for.

However, you can use aggregate functions to specify a scope and the row and field; for example, to show the ProgramId field from the first row of a dataset, you can use the First function, specifying the scope of the dataset:

=First(Fields!ProgramId.Value, "MyDataset")

So you could do something like this for the Visibility-Hidden property of the footer:

=IIF(InStr("10090,116,10094,10083", First(Fields!ProgramId.Value, "MyDataset")) > 0, True, False)

Upvotes: 3

Hannover Fist
Hannover Fist

Reputation: 10880

The footer and header sections of an SSRS report cannot have dataset items.

You can use the ReportItems to refer to a text box that is on your page.

Create a text box on your page with the value that you need then refer to that text box with the expression in your footer.

=IIF(ReportItems!TextBox1.Value = 4321, NOTHING, "Your Text Here")

MSDN: Report Items

Upvotes: 1

Related Questions