Brian Dunning's FileMaker Custom Functions

UpdateValueWhenNotDisabled ( currentValue ; newValue )

In an Auto-enter Calculation: updates the field value to newValue if $$DISABLE_UPDATE_VALUE is False. If $$DISABLE_UPDATE_VALUE is set to True, the field retains currentValue.

  Be the first to rate this function Log in to vote

Dale Long   Dale Long - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
field Order::account_modification contains value "Jack" and has the following auto-enter calculation:

Let ( ~trigger = GetField ( "" ) ; UpdateValue ( Self ; Get ( AccountName ) )


User with account name "Jill" edits and commits the record.



  Sample output:
$$DISABLE_UPDATE_VALUE = True ; "Jack"
$$DISABLE_UPDATE_VALUE = False ; "Jill"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

I've run into problems with doing extensive refactoring an old database. This often requires transforming data in existing fields or seeding data in a new field. Modification timestamps, modification accounts, etc. get updated during these processes, which gets rid of 'real-world' data. Who was the last person to modify this record in actual use? And when did that happen?

I've reconfigured the modification_account and modification_timestamp fields in this database to use an auto-enter calculation rather than using the 'Creation' or 'Modification' checkboxes in the field options. This CF is used in those auto-enter calculations ('Do not replace existing value of field' is unchecked, so that the field can respond to record updates).

you can toggle $$DISABLE_UPDATE_VALUE to True in a script or other Let statement in order to suppress any updates to that field. Once any transforms or data seeding is complete, Toggle $$DISABLE_UPDATE_VALUE back to False or "", and auto-enter updates will resume normally.

**edit - made CF name more verbose to clearly identify its function. Changed from UpdateValue to UpdateValueWhenNotDisabled

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 16 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: