I'm passing a dataset to a report using an object data source. The data source contains object of a custom class. This class have a list of nested object.
I need to output the value of 3 of these objects or String.Empty
. So if the list contains 'A' and 'B', the report should output 'A', 'B' and ''.
I print the value of the object in the list like so:
=Fields!MyList.Value(0).ObjectPropertyToPrint
However, if the list doesn't contains 3 items, I have #Error
.
I've tried this way
=iif(Fields!MyList.Value.Length >= 2,Fields!MyList.Value(2).ObjectPropertyToPrint,"")
and
=iif(Fields!MyList.Value.GetUpperBound(0) >= 2,Fields!MyList.Value(2).ObjectPropertyToPrint,"")
But both results in #Error
I also tried to output only
=Fields!MyList.Value.Length
=Fields!MyList.Value.GetUpperBound(0)
But both printed #Error
This is the C# List object I'm using. It's only a workaroung to pass nested object to rdlc
[Serializable]
public class MyObjectList : List<MyObject>
{
public MyObjectList () { }
}