digitalchaos Posted May 8, 2003 Posted May 8, 2003 Hello everyone I am having a problem with a counter see example below Set Field ["Count Field", "Count Field +1"] If ["Count Field >5"] Perform Scripts [sub-scripts,"run today"] Set Field ["Count Field", "0" End if All it does is set the count field to "0" and nothing else if i look in the global field count field it does not go up in number 1,2,3,4,5 it is just set to '0" All i really want to do is execute a script after the file has been opened a number of times on shut down based on if a certain number has been reached am i on the right track Thanks for any help i may receive in advance
Pupiweb Posted May 8, 2003 Posted May 8, 2003 If I understand correctly you're missing the loop; the below script will increase a global field gCounter till it is more than 5, and will reset it to 0 afterwards: Loop Set field (gCounter, gCounter +1) If (gCounter >5) Perform script (run today) End If Exit loop If (gCounter >5) End Loop Set field (gCounter, 0)
LiveOak Posted May 8, 2003 Posted May 8, 2003 What this script does is dependent upon the context in which it is used. You didn't specify what the field type is for "Count Field". 1) If it is a number field, the contents depend upon what record you are on when the script executes. 2) If it is a global number field used with FM Client in a single user environment, it will retain a number between openings and closing of the file. 3) If it is a global number field in a file hosted by FM Server, the number in this field will be the last number stored in this field when the file was closed with FM Client in a single user mode. In this case, global fields are user unique, just like the current found set and sort order and disappear when the file is closed. A little more context of how you are using this (the big picture) is necessary to explain what is happening. -bd
Mike D. Posted May 8, 2003 Posted May 8, 2003 Since you said that Count Field is a global, are you running this on a single machine or off a server? In a network solution, globals are local to the client. If you are running off a server, look at this thread. http://www.fmforums.com/threads/showflat.php?Cat=&Board=UBB16&Number=59229&Forum=All_Forums&Words=network%20global&Match=And&Searchpage=0&Limit=25&Old=allposts&Main=59190&Search=true#Post59229 HTH, Mike
digitalchaos Posted May 9, 2003 Author Posted May 9, 2003 Ok people this is how i finally got it to work Set Field["Backup Count Field",Backup Count Field +1"] If["Backup Count Field >5"] Perform Script[sub-scripts,"Sub Backup"] Else End If If["Backup CountField >5"] Set Field ["Backup Count Field","0"] End If And this is the Sub Backup Script Show Message Save a Copy as Close this work perfectly now for me i test it quite a few times
Recommended Posts
This topic is 7873 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 accountSign in
Already have an account? Sign in here.
Sign In Now