SSRS no data in report

ssrs-2008

I have a single tablix on the SSRS report which fetches data from a stored procedure.

I am trying to show a meesage to the User when no data is present say, "** There is no data for this report*". I can do this easily by specifying this message in the **NoRowsMessage property of the tablix. But I want to show the headers of the tablix along with this message.

If I don't set the NoRowsMessage property, I get the headers but no message, but if I do, I get the message but no headers.

I need some help with this.

Note: I am using SSRS 2008.

Edit:

I can also put up a textbox with the relevant text message below the tablix and set it visible only if the tablix contains no rows. But I am not able to figure out as to how do I find out from the Visibility expression of the textbox whether the tablix contains any rows or not.

Best Answer

A tablix object is related to the underlying dataset, so if there's no data, there's no table in the output.

Other than using the NowRowsMessage property, the only other way I can think of to enforce this would be to ensure your query returns an empty value placeholder when there are now rows returned. This way you would have, in essence, a single data row.

You could then try and add a conditional expression on the table (i.e. on the Visibility property of the details row) to prevent any rows containing your placeholder from showing up.

So in your query you could have:

IF (@@ROWCOUNT= 0)
BEGIN

SELECT 
'[IAMEMPTY]' as [Col1]
,'[IAMEMPTY]' as [Col2]
,'[IAMEMPTY]' as [Col3]

END

And then in the Visibility property of your table's detail row:

=Iif(Fields!Col1.Value = "[IAMEMPTY]",True,False)

EDIT: Alternatively, to check if the DataSet is empty in SSRS and show a rectangle containing your message/headers (as mentioned in TooSik's comment), you could set up a rectangle with this in the Visibility expression:

=Iif(Rownumber("Dataset_Name")=0, False,True)
Related Topic