I am making a form where we report how much leave is being used. The leave will be reported in 15 minute increments. (Ex: fifteen minutes = .15; one-half hour = .30; 45 minutes = .45) I need to be able to add these up and have them keep this format of 15 minute increments. Also, I need the display to be a decimal instead of a colon, if possible. (Ex. 3.45 instead of 3:45).
any advice is appreciated!!!
here is a formcalc example to get you started
$.rawValue = Left(textField1.rawValue, 5) ////////on TextField2.rawValue
$.rawValue = Len(TextField1.rawValue)
$.rawValue = Right(TextField1.rawValue, 5) ////////on TextField4.rawValue
$.rawValue = concat(TextField2.rawValue, TextField4.rawValue)
take your value and split it into an array
use len to find out how many numbers are in your value
Len(s1) Returns the number of characters in a given string.
then using a little math split it using
Left and Right
Left(s1, n1) Extracts a specified number of characters from a string, starting with the first character on the left.
Right(s1, n1) Extracts several characters from a given string, beginning with the last character on the right.
when done modifiying the decimal portion of your array as I described earlier then concat them back together
Concat(s1 [, s2... ] ) Returns the concatenation of two or more strings.
String.concat(s1, s2 [, s3 ... ])
here is an example using 2 textfields (you could hide one or not)
form1.#subform.TextField2::calculate - (FormCalc, client)
if ( TextField1.rawValue == 50 )
$.rawValue = "30"
you could do that for 15 30 45 00 etc simply reformat it using smoke and mirrors
Thanks so much for trying to help!!
I need to calculate leave taken by an employee in 15 minute intervals.
1.15 hours of vacation (one hour and fifteen minutes)
+2.30 hours of holiday leave (two hours and thirty minutes)
+ 4.45 hours of sick leave (four hours and forty-five minutes)
= 8.30 hours of total leave taken (eight hours and thirty minutes)
Anything I try has calculated it as:
I have to have it formatted in 15 minute increments instead of decimals
as far as the colon and decimal this can be done under patterns
but could you give a little more detail Im a little hazy on what your trying to do
The easiest thing may be to break it into 2 fields or three if days
___days ____hours ____min
this way you can manipulate the data a little easier depending on your requirements
Sorry if Im no help still a little hazzy on what yoru trying to do as far as summing
are you going to chang the .15 to a .25 for your calculations ?? and then translate them back to 15 min incriments etc....