August 29, 2008 at 11:51 am
[rsRuntimeErrorInExpression] The Value expression for the textbox ‘Calc’ contains an error: Input string was not in a correct format.
Why is this code to populate the textbox getting that error:
=IIf(ReportItems!LocalBallots.Value<>"" AND ReportItems!CountyBallots.Value<>"" AND ReportItems!CountyBallots.Value<>"0" AND ReportItems!CountyBilling2.Value<>"",ReportItems!CountyBilling2.Value*2,"")
The problem is the multiplication sign -- *. If I take out the "*2", it works.
But I NEED to multiply it by two. What gives -- why is this wrong?
(I also tried converting it to double using CDbl -- but that in itself gets the same error, even if I take out the *2.)
August 29, 2008 at 1:19 pm
Do you have a NULL? Check for NULL using Dataset!Field.Value Is Nothing. I'd do this in your case:
=IIF(LEN((ReportItems!LocalBallots.Value &
ReportItems!CountyBallots.Value & ReportItems!CountyBilling2.Value).ToString().Trim) <> 0 AND
ReportItems!CountyBallots.Value<>"0", ReportItems!CountyBilling2.Value*2, "")
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
September 2, 2008 at 10:18 am
I discovered that IIf statements always evaluate all paths, even if a path is not going to be executed. So even though I check to see if a field is blank, it still tries to multiply the value by 2, even though that path will not be executed.
I discovered also that there is a Switch statement allowed in RS, so I am going to give that a try and see if it will work better.
September 2, 2008 at 10:29 am
Interesting find. I knew about switch, but I really dislike the syntax in SSRS.
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
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy