Mod() is what you seek ...
For example, to know if the record number is odd:
Mod ( Get ( RecordNumber ) ; 2 )
... and even would be:
not Mod ( Get ( RecordNumber ) ; 2 )
... replacing the blue with any number or calculation.
Mod is the smart math person's way of doing things and I'm sure LaRetta is much smarter than me. Simpler people from Texas, like me, do things like:
If ( <some number> / 2 = Int ( <some number> / 2 ) ; "Even" ; "Odd" )
fyi, "Int" is short for integer and if you have a number like 8.9283749283, it chops off the decimals and leaves you just with the Integer of 8.
This makes sense to me because
4/2 = Int ( 4/2 ) 2 = 2
3/2 ≠ Int ( 3/2 ) 1.5 ≠ 1
But I have to admit, it would be nice if this was just a function like in Excel.
Mod ( ) using the divisor 2 will result in a 1 for odd numbers (ie. a modulus exists) and a 0 for odd numbers (ie. there is no modulus because the number is divisble by 2). As it is a boolean result you can set it to display the words "odd" and "even" if you wish, or incorporate this result into an If ( ) calc function.
To be pedantic, Mod() does not return a boolean result. It returns a number. For the case when the divisor is 2 the results may be interpreted as boolean true or false but this is a special case, and not a generally valid interpretation.
Mod( 1 ; 2 ) is not returning boolean true, it's returning 1
Mod( 2 ; 2 ) is not returning boolean false, it's returning 0
Mod( 7 ; 5 ) is returning 2
Vaughan said, " Mod( 1 ; 2 ) is not returning boolean true, it's returning 1"
Stop ... you're both right ... it can be a floor wax AND a dessert topping. ( that's an old Saturday Night Live ) ...
No, it does not return just 1 or 0 - good clarification - it returns the number result of its evaluation. But, and you know this so just clarifying for others who may be confused about now, all characters/data produces boolean result always whether it likes it or not. Dates are always boolean true whereas text fields without numbers are always boolean false - the boolean is a state of being more than a result. Any number but 0 produces true (1).
But mainly I wanted to use the Saturday Night Live saying and say hi to you - nice connecting with you over in these parts!
Fair points, both of you. Perhaps I should have written "As it is LIKE a boolean result…" to be more accurate. Dividing by 2 is, as Vaughan noted, a special case which, with whole numbers will I believe give only a 0 or 1.
Thank you LaRetta. Exactly what I need (and thanks to all other responders). It's obvious when you see it. It's been a long time since I've used this function.
Keywords said, "Perhaps I should have written "As it is LIKE a boolean result…" to be more accurate. "
LOL, You had it right the first time; no 'like' about it ... it PRODUCES number result and it IS a Boolean ... whether 1 or 0 ... everything is.