Jump to content

Automatic set field on record modify


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

Recommended Posts

Hi all

FM Dev5.5 on WinXP pro

I want to be able to set a field to a field value, the users name, when a record is modified, but I do not want to use the modifier name which grabs the username in the FM Application Prefs.

I have a login system which the user has their own login and password which is linked to their full name on sign up to access teh system, this all works well, and I have a series of globals to set the current users name in a global field upon login in a Globals file from which to grab the modified record username from when a record is modified. All that seems to be working fine, but I am not sure how to define a 'modified by' field to automatically calculate itself, and set itself automatically to the users name whenever any field in the record is modified.

I have tried a number of options and for the life of me cannot figure this one out and I am pretty sure that since FM has a standard auto modified by feature (to add the App-Prefs username) there should be a way of doing this, its probably quite simple but just cannot find what I am looking for to get it to work.

So over to you guys for some help, many thanks.

Greg

Link to comment
Share on other sites

Check the Article section for Ray's complete solution in indexing unstored values.

Basically, you'd use a lookup to retrieve in an index the g_UserName or any unstored calculation you're using for it.

This lookup will be triggered anytime a record is modified, and you could concanate this new index with the Modification Time and Hour on to another indexed field.

The lookup would involve these fields

ID

ModTime (autoentered modification time)

g_Username

c_Trigger = (ModTime*0)+ID

TriggerModRel = c_Trigger::ID

t_Username = Lookup from g_Username by TriggerModRel

HTH

Link to comment
Share on other sites

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