A holiday request form is completed in hours, the shortest holiday allowed is 4 hours. I’m writing a QuerySave script to do validation for this. Where shortest holiday allowed is called shortestHoliday, and actual holiday requested is numHours. I’d like to say
If numHours * (1/shortestHoliday) Is an Integer (or a whole number, ie no fractions) Then …
How do I do this in LotusScript, I can’t find any info anywhere and anything I try to guess doesn’t work…??
Subject: How do I evaluate if result is an integer data type ??
You could possibly use the Fraction function in lotusscript. This returns any part of the number after the decimal point.
Probably something like :
If Fraction( your_calculation ) > 0 Then
’ this is not a whole number
Else
’ it is
End If
Craig.
Subject: How do I evaluate if result is an integer data type ??
another way to go : the modulo operator :
If numHours mod shortestHoliday = 0 then
’ numHours is OK
Else
’ numHours in not OK
Endif
In your case, it probably isn’t of much interest, but the mod operator is much faster than a division ( / ) operator.
Subject: RE: How do I evaluate if result is an integer data type ??
I like the MOD one, thanks very much for your replies !