Jump to content

Disable Auto-Enter during script?


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

Recommended Posts

I have several older databases (not designed by me) that do not have unique key/identifiers in each table. I would like to run a simple script that loops through every record in the table and adds a serial number (which would then be incremented in the future automatically). Is there a way to disable the auto-enter options during my script, so that I do not alter all of the "last modified date" and "modifier" fields in every table? I know that I can do this during data import, but I'm not sure if it's possible via scripting?

 

Thanks!

Link to comment
Share on other sites

I think I solved this simply by turning off the auto-enter option while I run my script. :)

 

I would still be interested to know if it's possible to do this within the script - turn off auto-enter option and then turn back on.

Link to comment
Share on other sites

Hi Courtney!

 

What if you include looking for the script within the auto-enter so begin your script with:

 

Set Variable [ $stopAE ; 1 ]

... put your regular script steps here

 

Then within your auto-enter fields where you want to possibly stop their firing, the calculation would be:

 

Case ( not $stopAE ; ... your calculation here )

 

You would probably want to uncheck within the calculation dialog, "Do not evaluate if all referenced fields are empty" and back at the auto-enter tab, uncheck "do not replace existing value if any".  These exact combination of settings will depend upon what you want to achieve in your auto-enter and whether it is an AE Replace or not.  

 

You could also use:

 

Case ( Get ( ScriptName ) <> "Bla" ; your calculation ) but that would mean hard-coding the script name making it brittle.  By using a script variable, you could use the same $stopAE in several AE calculations and several different scripts (with caution of course) and it will not need to be cleaned up because it will die when the script ends.  It would stop all AEs with this variable however. 

 

Originally it sounds like a great idea - possibly a checkbox within the field definition - but it would be less flexible than script variable. 

 

Edit:  Added blue and ...

 

Or reverse it - 

 

Case ( $stopAE ; Self ; your calc )

 

... and of course this would only work for auto-enter calculations and not auto-enter serials, modification timestamp or auto-enter data fields.

Link to comment
Share on other sites

Clever. And to be clear, you can use a calculation for modified timestamps, serials, and just about anything really. So there's your solution. Of course it takes a bit of work to set this all up in advance. Probably not worth it unless it's something you find yourself needing more than occasionally.

Link to comment
Share on other sites

  • 2 weeks later...

Another approach is to export the data to a fm formatted file and do your updates to the data and then import the data back in again without using the auto enter option on import. You will delete the old data prior to rein porting it. Just be careful of any possible delete related record settings in the relationships graph.

Link to comment
Share on other sites

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