How do I make a timestamp button? I want "tim...

(Amy Lankford) #1

How do I make a timestamp button? I want “time started” to look like a button similar to “Job Status” but where they cannot modify the time after the button is clicked.

(Dinh Nguyen Nguyen) #2

@Amy_Lankford I’m afraid we do not support buttons for date time columns. If you want to capture the start time without allowing the app user to modify, you can set the Initial Value of the column to the expression NOW(), and mark the column as read-only.

(Amy Lankford) #3

Well if it is set to NOW() I also have a time completed under it will it place the NOW() time in each time they enter into the job?

(Dinh Nguyen Nguyen) #4

@Amy_Lankford The start time will only be reset to the current time every time the user edits the row if the NOW() expression is used as the App Formula of the column. If the NOW() expression is used as the Initial Value, then only the current time when the row was first created will be captured.

(Steven Coile) #5

The Initial value expression is only ever set when the new entry is created, so it’s a good way to capture the start time if the start is expected to coincide with the creation of the record.

Initial value: =now()

By default, the user will be able to modify the time when creating and editing the record.

To prevent this:

Editable_If: =false

Note that Read-Only will not achieve what you want.

To capture the end time, you can use an App formula:

App formula: =now()

This will set the column to the current date & time each and every time the record is saved after editing (which really means it captures the time of the most recent edit, which may or may not correspond to the end of the job). The date & time used will be when the edit began, not when Save was clicked.

(Steven Coile) #6

Another way would be to make [Time Started] and [Time Completed] computed automatically according to changes in [Job Status].

For [Job Status], strictly enforce the workflow progression of Not Started to In Progress to Completed by setting Valid_If to:

=IFS(

IN([_THIS], {"", “Not Started”}), {“Not Started”, “In Progress”},

IN([_THIS], {“In Progress”}), {“In Progress”, “Completed”},

IN([_THIS], {“Completed”}), {“Completed”}, )

Then, for [Time Started], use an App formula to set the value to NOW() when [Job Status] is set to In Progress, but only if the value is not already set:

=IFS(

NOT(ISBLANK([_THIS])), [_THIS],

IN([_THIS], {“In Progress”}), NOW(), )

Similarly for [Time Completed], use an App formula to set the value to NOW() when [Job Status] is set to Completed, but only if the value is not already set:

=IFS(

NOT(ISBLANK([_THIS])), [_THIS],

IN([_THIS], {“Completed”}), NOW(), )

The above is untested.

(Steven Coile) #7

Just because this post sparked my imagination…

To determine how long the job has been In Progress, add a Virtual Column named Time on Job with the App formula: =IFS(IN([Job Status], {“In Progress”}), (NOW() - [Time Started]))

After creating the column, set its Type to Duration.

To determine how long the completed job took, add a Virtual Column named Time to Completion with the App formula: =IFS(IN([Job Status], {“Completed”}), ([Time Completed] - [Time Started]))

After creating the column, set its Type to Duration.