Skip to Content

Crystal Reports Display String Formula Error

I have an application which is running over hundred of system , I am facing an error in formula statement and only the best and optimal solution to change in Stored Procedure rather change in Report DLL . Below i m attaching the screen shots , If any body suggest the best solution.

When Gross < 0 then this error occurs.

any body suggest the solution

I have seen if i declare the variable string with default "0" then this error goes on. but I am really helpless

Error.png (14.2 kB)
data.png (11.0 kB)
Code.png (17.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 06, 2015 at 11:36 AM

    Hi,

    Try something like this:

    instead of if ToNumber({Report_Balance;1.Gross}) < 0 you can check

    if left({Report_Balance;1.Gross}, 1) = '-'

    Thanks,

    Raghavendra

    Add comment
    10|10000 characters needed characters exceeded

    • You would need to change the SP so that Report_Balans;1.Gross returns a 0 when the value is null or blank.  How you would specifically do this is dependent on what type of database you're connecting to (which you don't mention).

      However, that won't take care of your issue all of the time.  The only way to default your "string" variable to 0 will be to set it to 0 in the beginning of the formula.  This will require an update to the report.  Also, if you were to put the processing for this whole formula into the SP so that it returns as a field instead of processing the formula in Crystal, you would still need to update the report.

      -Dell

  • Jan 06, 2015 at 11:52 AM

    You can also try:

    if isnumeric({Report_Balance;1.Gross}) AND ToNumber({Report_Balance;1.Gross}) <0 then

      '-'&string & ' '

    else if {Report_Balance;1.SubGroup} = 2 OR ToNumber(string) = 0 then

      ToText("0.00")

    else '(' & string & ')'

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded