cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports Display String Formula Error

qadeer_akhtar
Explorer
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

abhilash_kumar
Active Contributor
0 Kudos

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

raghavendra_hullur
Active Contributor
0 Kudos

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

qadeer_akhtar
Explorer
0 Kudos

Its fine but I have to change in Query rather in Formula to avoid designer fix.

DellSC
Active Contributor
0 Kudos

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