Static "Saved" Time for Timesheet

Hi all,

Iโ€™m creating a timesheet for employees to manage their clock in & clock out. Right now I have 2 columns โ€œTime Inโ€ & โ€œTime Outโ€ that is non editable.

Time In = [Timestamp] so that employee can use the very initial time when they start the form

Time out = NOW()
Iโ€™m facing a problem with NOW() as employee might want to edit the forms after they saved. Once they went to the edit button, the time out changed to the current time instead of the time they saved.

Is there a way to keep a static time of the saved forms?

1 10 704
10 REPLIES 10

Steve
Platinum 4
Platinum 4

How did yo make them โ€œnon editableโ€?

Where does [Timestamp] come from? How do you implement Time In = [Timestamp]? App formula? Initial value?

How did you implement this? App formula? Initial value? Action?

Sorry, Because previously my app allows users to set the time themselves and I felt that the results werenโ€™t that accurate and many employees kinda cheat on the system. Thatโ€™s why I was trying to make the โ€œTime inโ€ & โ€œTime outโ€ non editable and only allows current time of the device.

The [Timestamp] is from the time when the row is created. I implemented in App Formula.

App formula.

Rather than using App formula for Time In, I would recommend moving the expression from App formula to Initial value, then setting the columnโ€™s Editable? setting to the expression, FALSE. This will set the columnโ€™s value when the row is created (whereas App formula resets it every time the row is changed) and prevents the user from changing the value.

Thanks! But the main concern is actually the โ€œTime Outโ€. How do I able to save a time for โ€œTimeoutโ€ of the form?

Pretty much the same way.

Hey @Steve_Tan I would make use of an action to set the timeout, giving the user the ability to tap it and set the actual time to โ€œnowโ€ but not allowing them to actually modify the value.

For the timeout, I would put a show if formula to restrict when itโ€™s seen so we donโ€™t see it in the form

  • Show If: CONTEXT(โ€œViewTypeโ€) <> โ€œFormโ€

Create an action that sets the value of the Timeout column (something similar to this)

  • For the condition of this action, use the following:
    • ISNOTBLANK([Timeout])
  • I would turn on the confirmation toggle, providing the user with some context about the button theyโ€™re pushing


Or you could create an enum column inside your timesheet table, and use that as a โ€œclock outโ€ button inside the form.
You could use a ChangeTimestamp column thatโ€™s watching this enum column for whatever value you use for the button text - when it finds that text, say โ€œClock Outโ€ it records the timestamp.
This would keep you inside the form, if you wanted, but requires a little more handling.

  • For the โ€œClock Outโ€ enum column
    • show if: Context(โ€œViewTypeโ€) = โ€œFormโ€
    • Only one option in the dropdown: โ€œClock Outโ€ (or whatever)
    • Editable if: ISBLANK([_this])

Once you do that editable if statement, once they select the clock out option, they canโ€™t unselect it - and if you base your timestamp on that then you get your clock time.

You could apply an additional show if to the button, only showing it when itโ€™s blank - that way after they tap the clock out button, it disappears (maybe making the clock out time visible (but they canโ€™t edit it as itโ€™s a Change column and is controlled via the system)).

Hi,

I followed your instructions but I dont see any button in the form. Do I miss out something?

Actions arenโ€™t visible inside the form, theyโ€™re for modifying data outside in the other view types.

My suggestion was to move the โ€œclock outโ€ mechanism to an action, visible on the detail view (or possibly a table or other inline view) that the user can tap to clock out faster than having to go through the form.

Hi,

Is there a way to be edited in the form instead?


If I understand correctly: you want the [End Time] to not be editable when they user is first creating the record, but editable when they edit the record again, but not after they enter the time. Yes?

First: I wouldnโ€™t even SHOW the [End Time] during the initial record creation, only show it when they come back to edit the record.

There are many different ways to skin a cat, but perhaps the easiest would be to base things off timestamps. For example: the following formula will hide the column, but only for the first minute after the record was created if put in the Show If space:

NOW() >= ([Timestamp] + "000:01:00")

You can easily adjust the time window by changing the duration youโ€™re adding to the timestamp.

Second: I would restrict the [End Time] columns editability for ONLY when itโ€™s blank, some time has elapsed since the record was created.

I would put the following formula inside the Edit If space:

and(
  isblank([_this]),
  NOW() >= ([Timestamp] + "000:01:00")
)
Top Labels in this Space