开发者

Reporting Services - Getting 0 Values Even with Null Data - Referenced Assembly

For an SSRS project 2008 3.5 Framework, I am trying to have all numeric fields return number even if no record is provided from the dataset. The following expression works if there is no record returned from the dataset:

=IIF(IsNothing(Fields!Location.Value),"0",Fields!Location.Value)

However the following call to an external assembly and a method that returns a double doesn't work if there is no record in the dataset:

=SSRSHelper.Helper.NEValue(Fields!Location.Value)

With the following C# method being called:

    public static double NEValue(object val)
    {
        if (val != null)
        {
            string valStr = val.ToString();
            double valDbl;

            if (double.TryParse(valStr,out valDbl))
                return valDbl;
        }

            return 0.0;
    }

The method works when nothing is explicitly passed and when a valid value is passed.

Your help is greatly appreciated.

Correction: The inline expression doesn't work either. Rega开发者_开发知识库rdless, the report requires 0 values to populate when the dataset is empty and I would prefer doing this in an external assembly so that it can be referenced by many reports.

Frank


If the data set is returning no records (rows), then you won't have any data rows displayed in your report. Depending on where you placed your code above, it probably isn't even being called. The detail data group is repeated as many times as there are records in your data set.

If you would like a row to be displayed when there are no records returned, then you need to have a row outside of the data group, such as the table header or footer, and set its' visibility to change based on the number of records in the dataset. Set visibility to something like=IIF(CountRows("Dataset1")=0,false,true)

Or am I missing something in your description?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜