Forum Discussion

NeveLeem's avatar
NeveLeem
Qrew Trainee
8 years ago

Date stamp formula for checkbox

Hello.

I have a quick question regarding date stamps.

I have two check-boxes on my form: import and export. For both, I hope to create a formula date stamp field to see when users ticked these boxes.

We have a few older records to see when they were imported and exported. When they built this application, they did not anticipate the importance of these check-boxes.

Is this at all possible? 

Thank you very much for all of your help!
  • if the data entry is being dome via the form and never by grid edit, then you can create two fields to hold the date the checkboxes were checked.

    Use a form rule such as

    CONDITIONS:
    when multiple conditions are true.
    checkbox 1 is checked
    date checkbox 1 checked is blank.

    ACTION

    change date checkbox 1 checked to the current date.

    Be sure to uncheck the box at the bottom of the form rule so it fires all the time.

    You will need to have two Form rules, one for each checkbox.
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Another option if you aren't going to be editing individual records on the form, is to make a formula-url field that performs an API_EditRecord function to check the box, timestamp, and even add who clicked it (if desired).

    These buttons can be used in reports, or on the form.
    • ChrisFaye1's avatar
      ChrisFaye1
      Qrew Cadet
      It's been a while, but Matthew can you point me in the direction of how to do this?
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      I'm not sure if Matthew is still active on the forum.

      Here is some code to updates some fields ona record and refersh

      var date TodaysDate = Today();

      var text Update = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
      & "&apptoken=xxxxxxxxx" // you will need to decide if you want to require app tokens or just disable in App properties
       & "&_fid_100=" & $TodaysDate // put the date into fid 101
       & "&_fid_101=" & totext(User()) put who clicked into fid 102
      & "&_fid_102=1" ; set a checkbox to be true

      // then put in this code to execute the formula variable called URL and refresh the page

      var text URL = 
      "javascript:" &
      "$.get('" & 
      $Update & 
      "',function(){" &
      "location.reload(true);" &
      "});" 
      & "void(0);";