Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I have come up with a timestamp auto-enter calculation that updates conditionally only if a value in certain fields change.  For example, Table I has fields a, b, c, d, and e.  This mod timestamp should update only if the value in b, c, or d changes (it will be a separate field from the housekeeping mod timestamp of the table that updates on all changes).

 

I've tried something like:

 

Let ( ~trigger = b or c or d ; If ( ~trigger ; Get ( CurrentHostTimestamp ) ; Self ) )

 

This appears to render the desired behavior.  I am most interested to get the opinion of some experts about whether this is a safe method for accomplishing this.  Are there any gotchas I should be aware of before I move forward with implementing this?

 

There is also one other question in addition to this.  Most of the fields I need to include in this mod timestamp have a key piece of nomenclature, in that the field names all start with 'field_' .  It would be nice if I could do a single calculation to capture all these fields in one step, but I can't seem to figure out how to accomplish this.  I can just list all the fields individually, but this wouldn't be self-calibrating should I add another of these 'field_' fields to the table in the future.  I was curious if anybody had any clever ideas about how this might be accomplished.

 

Thanks for any advice you might have!

Posted

I routinely use something very similar to your calculation when I need this sort of modification timestamp. However, the If ( ~trigger ... ) part is unnecessary — you can just put Get ( CurrentHostTimeStamp ) there. The auto-enter calculation will already only update if one of those fields updates.

 

There is a way to get all the field names for a table, and all the names that start with "field_" could be parsed out with a custom function, but that wouldn't work for this application. The auto-enter calculation needs a vanilla direct field reference to trigger an update.

Posted

What about 

 

LimitedModTS = Evaluate("Get ( CurrentHostTimeStamp )";[b; c; d] )

 

Jeremy, I read oilcan's request as one field that would update a timestamp if only certain other fields were modified.  I don't understand how an auto enter would identify only those certain fields.

  • Like 1
Posted

The auto-enter (replacing existing contents) re-calculation will only be triggered when fields referenced in the calculation are modified, thus the ~trigger Let statement and your own use of the Evaluate function. Modifications to fields not referenced in the auto-enter calculation will not trigger it to re-evaluate.

Posted

 

I've tried something like:

 

Let ( ~trigger = b or c or d ; If ( ~trigger ; Get ( CurrentHostTimestamp ) ; Self ) )

 

Do you only need the timestamp, or would you like to know who and what fields were modified?

  • Like 1
Posted

thanks for the feedback guys.  Sounds like my proposed method, or doughemi's method would both work for my needs.  Too bad there probably isn't a way to hook all the fields with a single sneaky calculation, but such is life sometimes.

 

@Lee, I only need the timestamp.  It's part of a timestamp based sync method, I don't really care by whom or which fields got updated, I only care to have the timestamp update if the fields in question are updated while avoiding timestamp updates on fields that are not synchronized, causing an unnecessary resync of that record with no changed data in the relevant fields.

  • 2 months later...
Posted

Look up UltraLog on Google.

 

I use UltraLog and pass to it a list of fields in a global variable.

 

The global variable is set up when the file is opened. It get's the list of all fields from the table:

 

ExecuteSQL ( "SELECT FieldName FROM FileMaker_Fields WHERE TableName='" & "my_table" & "'" ; "" ; ""  )

 

But if you wan't only fields that start with "field_", then you'd change the ExecuteSQL statement to :

 

 

ExecuteSQL ( "SELECT FieldName FROM FileMaker_Fields WHERE TableName='" & "my_table" & "' AND FieldName LIKE 'field_%'" ; "" ; ""  )

This topic is 4130 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.