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

If-then-else statement

Status
Not open for further replies.

hereigns

MIS
Sep 17, 2002
172
US
Here's the statement:

If (({tblInvoiceDetail.Quantity} < 1))
then ToText ("C")
else ("")

Which works well for items that are less than 1. But any idea on how I configure for instances that are less than whole numbers, for example: 1.5, 10.3, etc...?
 
I am not sure I follow the question. Your formula looks OK but in your examples 1.5 and 10.3 are not less than 1 so your else condition should be met.

-- Jason
"It's Just Ones and Zeros
 
It ought to work fine for fractions. Test and see what you get.

It also ought to work as
Code:
If {tblInvoiceDetail.Quantity} < 1
    then "C"
    else ""

You should give your crystal verison - 10, 9, 8.5, 8 or whatever. Click [Help] and [About Crystal Reports] if you don't know it already.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
jdemmi,
The formula works for numbers less than 1, which is good but I need to expand the formula so that numbers in the field that are anything but whole numbers, i.e., 1,2,3...have the text "C" when the report is run.

In other words, ALL fractional numbers will display the text "C".

madawc,
The formula does not work for fractions, only numbers less than 1.
CR version is 10.0 professional.

Thank you both for taking the time to answer my question. I really appreciate it!
 
Try:

if {tblInvoiceDetail.Quantity} <> int({tblInvoiceDetail.Quantity}) then "C"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top