Forum Discussion

BarryDolan's avatar
BarryDolan
Qrew Trainee
4 months ago

Button click to populate a field with the current time

I'm using a formula URL button to input the current time in a "Clock-in" field. I have another formula URL button to input the current time in a "Clock-out" field. It works, and we have the employees use the mobile app to clock in/out each workday.

The issue we are having is that if the employee doesn't close out the app after clocking in, when they clock out, it will input the same time from when they clocked in.

Does anyone know how I would modify this code so it will capture the current time, every time, no matter if the app has been closed or not?

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=MYAPPTOKEN" 
& "&rid=" & [Record ID#] & "&_fid_433=" & ToTimeOfDay(Now()) & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))



------------------------------
Barry Dolan
------------------------------

2 Replies

  • URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=MYAPPTOKEN" 
    & "&rid=" & [Record ID#] & "&_fid_999=now"

    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))

    The syntax above will populate the field fid 999 with the current date and time when the button is pushed as opposed to the old "stale" value when the page first loaded.  The issue is that it is the current date/time and not the time of day.  So you will need to rework your app or if you have existing data, have a new fields going forward which make use of the date/time stamp  and use formulas to calculate the Time of Day from them.

    Your Time Card punch in / punch out use case is EXACTLY what that syntax is meant to address. 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • BarryDolan's avatar
      BarryDolan
      Qrew Trainee

      I will reconfigure and give it a go.

      I'm not sure what you mean by your last sentence. But your mod to the syntax makes complete sense.

      Thanks, Mark

      Happy New Year!



      ------------------------------
      Barry Dolan
      ------------------------------