reportingrdlclocalreport

#Error on Local Reporting


I'm having trouble with an RDLC using Local Reporting. I pass a 'QOI' object into the report, and I'm trying to get it to read the customer information.

The QOI object contains a customer object. This customer object has fields such as first name, last name, mid name, addresses, etc. I need to check if the QOI objects customer is null, and if not, write the firstName to a text box. So I've been trying this code...

=IIF(
    IsNothing(First(Fields!customer.Value, "QOI")),
    "Cash Sale", 
    First(Fields!customer.Value.firstName(), "QOI")
)

But that will just make the textbox say '#Error', with or without a customer attached. So, I tried this way.

=First(
    IIF(
        IsNothing(Fields!customer.Value),
        "Cash Sale", 
        Fields!customer.Value.firstName()
    )
    , "QOI"
)

but this one gives me an #Error if theres no customer, or it says 'The specified operation is not valid' if there IS a customer... However, the following code works perfectly for stores.

=First(
    IIF(
        IsNothing(Fields!store.Value),
        "Store Not Set", 
        Fields!store.Value.name()
    )
    , "QOI"
)

I've checked my variable names, intercepted the object and made sure everything was accurate... it just seems to hate customers. What could be causing this?


Solution

  • The only solution I could find was to create a custom object specifically for this report, and use a method that takes a QOI object and spits out a QOIReceipt object that has everything already populated. If anyone can see where I'm going wrong please let me know, otherwise the custom object seems to be the way to go.