Question

I've got a report in SSRS 2008 that is using a web service as one of its data sources. The basic look of the XML returned is

<table>
    <row>
        <column1>data</column1>
        <column2 xsi:nil="true" />
        <column3>data</column3>
    </row>
</table>

Any tags with the "nil" attribute are showing up as blank on the report. I'd like to replace any blanks with a dash. Since it is a numeric field and zero has meaning in the report, I can't simply change the web service to return zero or an empty string. I've tried to do several kinds of conditional compares to swap them, but they all show up as "#Error" on the report:

=iff(Field!column2.Value Is Nothing, "-", Field!column2.Value)
=iff(IsNothing(Field!column2.Value), "-", Field!column2.Value)
=iff(Field!column2.Value = "", "-", Field!column2.Value)
=iff(CStr(Field!column2.Value) = "", "-", Field!column2.Value)

Any ideas?

Edit: It wasn't the check for empty that was failing, it was a nested conditional inside the first IIF. Once removed, I was able to make it work.

Was it helpful?

Solution

I didn't have a problem using:

 =Iif(cstr(First(Fields!RegInceptionDate.Value, "spimRptPerfSummary")) = "", "-", First(Fields!RegInceptionDate.Value, "spimRptPerfSummary"))

This is what my dataset looks like:

<Query>
   <Method Namespace="http://www.abc.com/" Name="TWRPerformanceSummary"/>
   <SoapAction>http://www.abc.com/TWRPerformanceSummary </SoapAction>   
   <ElementPath IgnoreNamespaces="true">
        TWRPerformanceSummaryResponse/TWRPerformanceSummaryResult/diffgram/NewDataSet/table{PkRegistration, InceptionDate(date),RegInceptionDate(string)}
   </ElementPath>
</Query>

My expression was in a textbox, thats why I have it wrapped in a First() on the DataSet. I cast the RegInceptionDate on the dataset as string (its really a date, but since its coming back null it didn't matter). I'm not sure the cstr() in the expression is necessary since I have the cast on the dataset itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top