Reputation: 2803
I have a numeric field(decimal in fact) in a report. And I need its value to stay in numeric format, because Sum of all rows be inserted after last row and if value of them change to string, then an error occurred(I think when calculating sum of them ran and sum for strings have not any meaning except concatenating).
Here is my last formula in DisplayString : (that causes error at runtime of course)
if {numericField} = 0 then "" else ToText({numericField})
What I want to learn is how can I tell to Crystal Reports replace zero values with null (or empty string or anything like this) and leave others?
Note that : I need sum of them in summarized section.
As Ryan explained in his comment, I should create a formula. I do these:
I'm new to Crystal report formulas. Can anyone help me? Thanks in advance.
Upvotes: 2
Views: 4350
Reputation: 7287
You can get a null numeric value by creating a formula with just a number in it, saving it, then deleting the number and re-saving. You'll be left with a formula that is empty but CR will treat it as a null value.
Then just use that formula instead of the empty string:
if {numericField}=0 then {@NullNumeric} else {numericField}
Upvotes: 2