Input string was not in a correct format

  • Okay, this one is confusing because it works for some values and not for others.

    I have a text box which displays a money value. I've edited the box and put in the following expression.

    =IIF(ltrim(rtrim(Fields!ID03_2007.Value)) = 0

    or isnothing(ltrim(rtrim(Fields!ID03_2007.Value))), 0,

    Round(Fields!ID03_2007.Value,2))

    Now, for specific occurances of the value, I'm getting the error:

    [rsRuntimeErrorInExpression] The Value expression for the textbox 'mytextbox' contains an error: Input string was not in a correct format.

    Like I said, though, it's not occuring on every row. For example, the report preview looks like the below:

    ProductName ID03_2007

    cars 200.00

    boats 150.00

    planes #Error

    Where it says "#Error" now, was blank before, hence the isnothing() function in the code. Any thoughts?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • What does the DB say is in the field erroring out? (i.e. what's the value causing the #error?)

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Hey Brandie, this looks like a reporting services, not Integration Services question, but I'll give it a shot anyway.

    What is being returned by the datasource in the planes row, empty or NULL? If it is null try using :

    IIF(Fields!ID03_2007.Value=System.DbNull.Value, 0)

  • I thought of that one, and from the little I can see - it looks like that .NET notation doesn't work.... Have you tried to throw on an ISNUMERIC thing to see what happens?

    Also - try putting a conversion on the field BEFORE the rounding to make sure you're not getting some kind of odd narrowing conversion failure.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Gosh darnit! I had multiple windows open this morning and thought I put this one in the SSRS forum. Sorry all.

    But I'll take Matt's suggestion and see if the IsNumeric comes up with anything. Thanks, Matt.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Jack & Matt,

    You were both right. Non-numeric empty string that I couldn't fix on the query side. Had to mask it in the report.

    Thanks to both of you and again, my apologies for the mis-post.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply