Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Lets say we set up a field that will update the date/time every time a record is modified. Is there a way to have a script run every time this field changes, or as the case really is, every time the record is modified?

One step further and even more specific. Is there a way to have a script trigger anytime a specific field is modified. Say we have a text field. Can we have another field that maybe contains a number based on a calc. And every time the text field changes the number in the calc field is updated. And when this number changes it triggers a script to run.

Any thoughts?

LR

Posted

Found another solution. First let me say why I needed this. I have one db file with a pretty complicated calc that pulls information from numerous fields. This calculated field containing these result is of such a nature that it can not be stored/calculated. I have a related file that I wanted to use a value list linking back to this calc. But as we know, a value list can not be based on a field that is not stored/indexed.

So I wanted to create a script that used the "Replace" function to copy the information from the calt field and place it into another indexed field that I could then use in my value list. I was looking for a way to trigger the script to do the replace any time any of the fields in the calc changed, thus updating the other field used in the value list.

I found another way to accomplish this automatically with a trigger. The tip listed below was from CobaltSky and is copied from his posting. I also created a quick dummy file putting his solution together to see how it would work. The file can be downloaded at:

http://63.226.105.147/web/Trigger.fp5.zip

And I quote CobaltSky:

"Set an indexable field to update automatically whenever a relevant event occurs. This would be done by setting the indexable field as a look-up (to copy the contents of your calculating field via a self-join based on recordID).

The trigger for the lookup should be based on a stored value local to the current record which, when it changes, will cause a refreshing of the lookup of the calculated value. This can be something specific to the nature and purpose of the calculation (eg a local value associated with it) or something as general as the record modification time. Once you select a suitable event to trigger by, you should create a primary key field for the trigger called 'cTrigger.key', with a formula along the lines of:

Case(IsEmpty(YourChosenTriggerField), Status(CurrentRecordID), Status(CurrentRecordID))

You then need a stored calculating field ('RecordID') of number type with the formula set to Status(CurrentRecordID) and a self-join relationship called 'ValueListUpdate' which matches cTrigger.key with RecordID.

If you then set up your indexable field as a lookup to copy the value of your unstored calculation based on the 'ValueListUpdate' relationship, it will be refreshed automatically each time the value you have chosen as the basis of your trigger changes (eg if it is a field which auto enters modification time, every time anything on the record changes)."

LR

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