Forum Discussion

CassieHubble's avatar
CassieHubble
Qrew Cadet
3 years ago

Button to create a date and time

I am trying to create a clock in/out like a timesheet. I would like to create a button that adds the current date and time to the field.

I have tried looking for this formula that is probably very straight forward but I can't seem to find it.

------------------------------
Cassie Hubble
------------------------------

2 Replies

  • If you are looking for a button that would work in View mode to update field ID # 99 to the current date/time, it would look like this

    var text ClockIn = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=xxxxxxxxxx" // only required if you gave application tokens enabled.
    & "&_fid_99=now";

    var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

    $ClockIn
    & "&rdr=" & URLEncode($RefreshPage)

    ā€‹

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------

  • To add on to Mark's response, if you want the ability to clock in and out, set up an other formula URL for clocking out. Put the buttons right next to each other in the form. Then, in the form rules, set up a rule that says if the clock in time is empty, show the clock in formula URL and hide the clock out formula URL. Depending on your use case, you may want to have another rule that hides both buttons if both the clock in and clock out time are already filled in. That way, the user will only see the button that she needs to see.

    ------------------------------
    Edward Hefter
    www.Sutubra.com
    ------------------------------