Jump to content

Date stamp record on Commit


This topic is 3572 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to stamp every record update with the Date and User name when a Commit has been done.

The idea is that every table would have a single Text field where only the latest User/Date stamp would go. When another user updates the record, it gets over written.

 

This seemed straight forward at first but a few things have complicated it.

 

I'm using a tabbed UI to display the contents of several related tables. Using a COMMIT button (with a script behind it) in every tab is silly as the user would be more inclined to click the tabs and forget to click the COMMIT button.

 

So instead of buttons, I was hoping to find a way to detect a Commit (since there are so many ways a commit can happen...).

From this angle, the user would not be able to avoid doing the stamp but how would I actually create the stamp?

 

Jason

Link to comment
Share on other sites

OnRecordCommit is a Layout specific script trigger that can be used to execute a script when FileMaker attempts to Commit the record.  Go into layout mode, Layouts Menu, Layout Setup..., Script Triggers.

Link to comment
Share on other sites

I'm trying to stamp every record update with the Date and User name when a Commit has been done.

 

Why don't you simply use the built-in mechanism of auto-entering the modification date/timestamp/account name? This doesn't require any script triggers and works independently of any layout (i.e. at the data level).

Link to comment
Share on other sites

Comment makes a good point. I was being a bit over the top and making the assumption there was a reason to go outside of the normal built-in functionality that Filemaker has for fields.  

 

Go to the Define Fields... Locate the field in question and select it, click on the Options.. button. Depending on how the field is setup (text,date,timestamp,time) you will have access to Creation or Modification options that are applicable to the field type.

Link to comment
Share on other sites

Hi Jason,

 

Keep in mind that, if you have existing records, their values will still remain empty until you make a change.  It is best not to leave them empty since Users sometimes search for records created or modified during certain ranges.  

 

You can quickly pre-fill both fields by setting the creation timestamp with any calculation (using Replace Field Contents) so it could be:

 

Date ( 1 ; 1 ; 2000 ) or Get ( CurrentTimeStamp ) or if there is an existing date in your system which more closely will provide the record's creation date, you can use that.  When you set the creation timestamp, the modification will fill in of course.

 

To signify that the creation timestamp is 'bogus-but-necessary', I use a date so the time comes out all zeros.  There are many ways to pre-fill these fields and that is usually a business decision.  Down the road, it can make a big difference if the theory on how they are set is known by management.

 

I mention this because I've seen this happen and folks forget.   Then later, they do not find all the records they are looking for and it's because creation was blank on many records.

Link to comment
Share on other sites

This topic is 3572 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.