calculating times in 15 minute increments | Community
Skip to main content
September 9, 2013
Question

calculating times in 15 minute increments

  • September 9, 2013
  • 12 replies
  • 41530 views

Good Afternoon,

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!!!

Gene-O

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

12 replies

September 16, 2013

Thanks for responding. It’s a bit too much for me also!!

Jono_Moore
New Participant
September 11, 2013
September 11, 2013

Also, this seems to want to do traditional math, instead of dealing with 15 minute increments, or am I missing something?

September 11, 2013

I’m so sorry, but I am lost! I have not had any training in scripting and trying to learn on my own….

September 10, 2013

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)

September 10, 2013

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.

String.length

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.

String.substring(n1, n2)

Right(s1, n1)  Extracts several characters from a given string, beginning with the last character on the right.

String.substring(n1, n2)

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 ... ])

September 10, 2013

I’m sorry, you lost me!

September 10, 2013

use the right and left function to split it into the seperate elements then concat to remerge them

you can use a script object to do this or a hidden field

September 10, 2013

Thanks again!

But this only works if I am inputting only “25”, “50”, or “75”. Not if I enter numbers with decimals such as “1.25”. Can I use a wildcard to represent the whole number?

September 10, 2013

here is an example using 2 textfields (you could hide one or not)

form1.#subform[0].TextField2::calculate - (FormCalc, client)

if ( TextField1.rawValue == 50 )

then

$.rawValue = "30"

endif

you could do that for 15 30 45 00 etc simply reformat it using smoke and mirrors