PDA

View Full Version : Test for odd-even number


ABC123

Albert Conner
03-23-2005, 04:52 AM
I need to test the result of a calculation to determine if the number is odd or even. Numeric field length is 5 decimals 0 (I have used the round function to round to integer.)

Exmpl: calculation result = 990 an even number. this is what I need to accomplish:
If field 1 =.t. and calculation result (field 2) is even field2 else field2+1

Can someone get me started?

Daryl Grace
03-23-2005, 05:02 AM
Try:

if(mod(field,2)=0,field,field+1)

Make sure you have already rounded field to an integer.


Daryl

Albert Conner
03-24-2005, 04:29 AM
Many thanks, that did it.