简体   繁体   中英

SSRS Local Mode Report zero displaying as blank

I have a SSRS (SQL Server Reporting Services) RDLC local mode report that is populated by an object data source. However the data from the database is returned as 0 but the report is displaying blank.

My datasource is a List<> of a type "ReportData" that is populated from a SQL Server query.

public class ReportData
{
    public object column1 { get; set; }
    public object column2 { get; set; }
    public object column3 { get; set; }

    public ReportData(object column1, object column2, object column3)
    {
        this.column1 = column1;
        this.column2 = column2;
        this.column3 = column3;
    }
}

Like this:

List<ReportData> results = new List<ReportData> {};

while (dr.Read())
{
    results.Add(new ReportData(dr[0], dr[1], dr[2], dr[3]));
}

Through debugging I confirm that the List is populated with values of "0" and that they are being turned into Decimals objects (The original SQL Server field is money type).

I then bind it to the ReportViewer control via:

ReportViewerControl.LocalReport.DataSources["ObjectDataSource"].Value = results;

And just use it normally inside the report (I added the datasource and use the "Website Data Source" panel to drag the values onto a table), as stated its not displaying "0" but just blank.

I am using Visual Studio 2008 with I presume the ReportViewer 2005 control (Microsoft not giving Local Mode tablix :() and querying a SQL Server 2008 x64 Standard instance.

Anyone got any clue why its not showing zeros?

Phil

It appears if you have a format expression of say "###,###,###.##" on a zero value it makes it blank. Just removed the format expression for the certain cases where zero values can occur and its fix.

If you want to keep the format you can change the FORMAT expression to test for zero.

= IIF(Fields!MyField.Value <> 0,"###,###,###.##","")

The above worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM