March 20, 2008 at 1:59 pm
I didn't see this come up in a search of the forums, but it's one of those things that drives you nuts when you can't figure it out. I decided I'd post the issue and a possible solution for future reference!
Issue 1: Your report includes a datetime parameter that has a default value of NULL. You want to pass it as a string within a textbox. DateValue(Parameters!yourdate.Value) works within an Expression when there's a value, but you get #Error when it is NULL.
You also can't use IIf logic like the following:
=IIf(IsNothing(Parameters!yourdate.Value),"",DateValue(Parameters!yourdate.Value))
Solution-- The IIf statement evaluates both True and False in line, so NULLs will always throw the #Error. You need a different way of converting for the True part of your statement that doesn't throw errors on NULL (even though a NULL won't end up being processed):
=IIF( IsNothing(Parameters!yourdate.Value), "", Format( CDate(Parameters!yourdate.Value), "M/d/yyyy" ) )
--------------
Issue 2: You need to divide number1 by number2, except when number 2 is NULL or 0.
Solution: You can do something along the lines of:
= Fields!Number1.Value /
iif(
Fields!Number2.Value is Nothing
or Fields!Number2.Value = 0, 1,
Fields!Number2.Value
)
--------------
Of course, if you can clean up the results through SQL before they get to the report, that's always best!
March 21, 2008 at 10:06 am
You can compare it to System.DbNull.Value and then convert it to String.Empty.
IIF(parameters.yourdate.value = System.DbNull.Value, String.Empty, paramterd.yourdate.value)
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 21, 2008 at 10:11 am
AWESOME!!! I have a feeling I'll come back to this thread in about 6 months when the issue pops up again and I forgot what works. Thanks for the input!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply