Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula help to remove decimal, Crystal 10 1

Status
Not open for further replies.

jp3333

Technical User
Jun 22, 2007
11
US
I need to remove the .0 decimals from my report. The measure 1 and measure 2 string values can be for example 98.0 and 98.6. If the value is .0 I need it removed; however, if it is 98.6 I need it to show the whole value. What I am looking for is either 98 or 98.6. Hope that makes sense and thanks so much for your help!

if isNull ({hsm11_flowsheet;1.measure2}) then "<b>"+({hsm11_flowsheet;1.attribute}) + "</b>" + " " + {hsm11_flowsheet;1.measure1} else
"<b>" + ({hsm11_flowsheet;1.attribute}) + "</b>" + " " + {hsm11_flowsheet;1.measure1} + "/" +{hsm11_flowsheet;1.measure2}

Jan
 
98 or 98.6?

Huh?

Which is it? You need to define what your rules are so we can help.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Sorry, I am really trying to be clear...what I am trying to say is that the report cannot display .0 decimals. If the values for measure 1 and measure 2 are:

Current This is what I need:
98.6 98.6
106.4 106.4
90.0 90
25.2 25.2
87.3 87.3
25.0 25

Is that clear?

Jan
 
Go to format field->customize style->decimals->x+ 2 and enter this formula:

if val(right(totext(currentfieldvalue,2),2))=0 then 0 else
if val(right(totext(currentfieldvalue,2),1))=0 then 1

Make sure that rounding is set to two decimals as well.

-LB
 
I couldn't figure out how to use this with the formula; however, I was able to format the fields correctly, after I changed them from a strings to numbers and the result works for us. You're awesome...thanks!!

Jan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top