Forum Discussion

frnmj's avatar
frnmj
Qrew Member
3 years ago

Time In/Time Out Formula

Hello, can someone help me with the formula for getting the current date/time and set it as value on field with a click of a button? Basically, I'm trying to create a time in/out table where it will have two buttons and two fields. Clicking the Time In button populates the Time Int field with the current date/time, same thing for the Time Out button.

------------------------------
frnmj
------------------------------

19 Replies

  • not tested but try thisas a formula URL button

    var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&apptoken=xxxxxxxxx" // if you have app tokens enabled
    & "&_fid_99=now";  /// assumes the field ID 99 is the date time field to be updated.

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


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

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • frnmj's avatar
      frnmj
      Qrew Member

      Thank you so much for the quick reply, I tried it out but I could not save the formula due to an error. It says it's Expecting datetime but found text.



      ------------------------------
      frnmj
      ------------------------------
    • frnmj's avatar
      frnmj
      Qrew Member

      I changed the field type from "Formula - Date/Time" to "Formula - Text" and the error went away. However, when I tried it out it takes me to this page:



      ------------------------------
      frnmj
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        The field type for the button to push is formula URL.  You need to adjust the 99 to be the field ID of the date time field you want to update.

        I suggest that you disable the need for application tokens.  That is set in the App Properties.

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