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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal number in a selection formula

Status
Not open for further replies.

crisedefoie

Programmer
Feb 19, 2003
39
CA
Good morning!

I have a very bizarre problem in Crystal 8.5.

I want to send a selection formula that looks like :
{table.BoardWidth} = 2.8 BUT it doesn't work !!!!

It works only with integer or '.5' decimals (ex : 1.5, 2.5 etc...) it doesn't work even with 2.51!

I tried to put 'totext({table.BoardWidth}) = '2.8' but it still doesn't work. With the comma, neither (2,8)

Does anybody know why this happens and especially how to solve this problem?

thank you!
 
Try to use:
-------------------------------------
Abs({table.BoardWidth} - 2.8) < 0.01
-------------------------------------

Decimals are notorious for not being &quot;exact&quot;.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thank you for your help,

but I'm very sure that the number is exactly 2.8.

I tried an other way to put it 'totext' and now it works!

Very strange!
 
That's because ToText (by default) truncates to 2 decimals so the inaccuracies beyond that point are gone.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
As IdoMillet says, Crystal may have fractional amounts beyond anything it will show you. I had this problem when I was trying to match payment amounts to overpayments. Even though our data was in pounds and pence, it was necessary to truncate to two decimal places before it would accepte the 141.47 was the same as 141.47. And the same applied to the results of calculation.

Lurking infinitessimal amounts are one of the hazards of Crystal.

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top