SSRS no data in report

后端 未结 1 380
轻奢々
轻奢々 2021-01-19 07:11

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, \"** The

相关标签:
1条回答
  • 2021-01-19 07:39

    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)
    
    0 讨论(0)
提交回复
热议问题