Date stamp formula for checkbox

  • 0
  • 2
  • Question
  • Updated 3 months ago
  • Answered
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!
Photo of Neve

Neve

  • 260 Points 250 badge 2x thumb

Posted 2 years ago

  • 0
  • 2
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.
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
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.
Photo of Robert Kreibich

Robert Kreibich

  • 172 Points 100 badge 2x thumb
 Simple and very useful.  Do you have an example on this? 
Photo of Chris Faye

Chris Faye

  • 132 Points 100 badge 2x thumb
It's been a while, but Matthew can you point me in the direction of how to do this?
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);";

Photo of Chris Faye

Chris Faye

  • 132 Points 100 badge 2x thumb
Thank You! Sorry - I'm new to formula url's. Where would I enter the specific fields i want to edit/update? Just in the fid_100,101,102, etc.? Also is there any other identifier's that i would need to fill?
Photo of Chris Faye

Chris Faye

  • 132 Points 100 badge 2x thumb
Are there edits needed? It's giving me an expecting error.

var date TodaysDate = Today();

var text Update = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&apptoken=dhxpiidu5cj4edz3d8kvbn2cium"
 & "&_fid_1469=" & $TodaysDate 
 & "&_fid_1468=" & totext(User()) 
& "&_fid_805=1" ;


var text URL = 
"javascript:" &
"$.get('" & 
$Update & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);";
Please post the complete error message text when you save the formula.
This might be the problem in the first line.

var text TodaysDate = ToText(Today());