Brian Dunning's FileMaker Custom Functions

StopwatchSeconds ( ctrlStartTimeLapListStopClear ; prefixText ; variableName )

Creates and manages a value list variable to track seconds with complete stopwatch controls: Start, Time, Lap, List, Stop, or Clear.

  Average rating: 3.7 (3 votes) Log in to vote

Lewis Lorenz   Lewis Lorenz
Lorenz Companies
http://www.LorenzCom.com

Share on Facebook Share on Twitter

  Sample input:
StopwatchSeconds ( "start" , "Loop test initialized:" , "" )
StopwatchSeconds ( "lap" , "Loop run started:" , "" )
StopwatchSeconds ( "lap" , "Loop process:" , "" )
StopwatchSeconds ( "lap" , "Loop process:" , "" )
StopwatchSeconds ( "stop" , "Loop run stopped:" , "" )

$$StopwatchSeconds
  Sample output:
0
45
53
57
84

63670547575
63670547659
Loop test initialized:0
Loop run started:45
Loop process:53
Loop process:57

Loop run stopped:84

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

StopwatchSeconds ( ctrlStartTimeLapListStopClear ; prefixText ; variableName )

by Lewis C. Lorenz
Updated: 8/22/2018

Creates and manages a value list variable to track seconds.
ctrlStartTimeLapListStopClear controls stopwatch functions. Full word required: Start, Time, Lap, List, Stop, or Clear.
prefixText prepends text to Start, Lap, and Stop valuelist elapsed time values.
variableName specifies $ or $$ variable name. If empty variable name defaults to "$$StopwatchSeconds".

Commands in parameter ctrlStartTimeLapListStopClear control the function's access to the variable. Control options:
"Start" resets the variable with a new current UTC start time as the 1st value and sets the 2nd value to 0. Returns 0.
"Time" returns the current elapsed time since the start time, without appending the value to the variable. Returns elapsed seconds.
"Lap" appends the elapsed time value to the variable. Lap may be prefixed with the prefixText parameter. Returns elapsed seconds.
"List" returns a value list of the Lap values that were appended to the variable by the Start, Lap, and Stop commands.
"Stop" sets the 2nd variable value to the current time and stops further Time and Lap commands. Returns the elapsed seconds since starting.
"Clear" empties the variable. Returns 0.

Variable values 1 and 2 are obtained from the function get ( CurrentTimeStamp) which can be displayed as Timestamps with the GetasTimestamp () function.

Examples:

StopwatchSeconds ( "start" , "Loop test initialized:" , "" ) = 0
StopwatchSeconds ( "lap" , "Loop run started:" , "" ) = 45
StopwatchSeconds ( "lap" , "Loop process:" , "" ) = 53
StopwatchSeconds ( "lap" , "Loop process:" , "" ) = 57
StopwatchSeconds ( "stop" , "Loop run stopped:" , "" ) = 84

$$StopwatchSeconds = 63670547575
63670547659
Loop test initialized:0
Loop run started:45
Loop process:53
Loop process:57

Loop run stopped:84

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.