emerywang Posted October 19, 2004 Posted October 19, 2004 Hi. I have created a running counter to keep track of which record I'm on. Since my file contains multiple account numbers, I first created a self-joined relationship called "self," where account number =::account number. My counter, then, is a number with an auto-entered calculation that looks like this: Count(self::account number) It works fine while I create new records. The counter dutifully enters the correct number of the record I'm on, after I enter the account number for the new record. So the 5th record with account number "3443" would have a counter value of 4, while a new record with a new account number yields a value of 0 (I know it doesn't start at one, but that's okay). It gets messed up, however, if I delete a record, or change the account number of that record, because the counter does not dynamically change. So, is there a way to create a counter that dynamically updates if I change the account number, or if I delete a record? Thanks. -Emery Ps: a calculation field won't work, because it dynamically updates all instances of that field, so it gives me the total number of records on each page. What I need is a running counter, not a total counter.
-Queue- Posted October 19, 2004 Posted October 19, 2004 Auto-enter calculations only evaluate when the record is created. You will have to script the field to change when a record is deleted or the account number is changed. I think the best way to accomplish this would be as follows: When a record is deleted, Go to Related Record [show, "self"] Go to Record/Request/Page [First] Loop Set Field [counter, Status(CurrentRecordNumber) - 1] Go to Record/Request/Page [Exit after last, Next] End Loop When a record's account number is modified, you would need a global to hold the original account number. Perform the above script steps, then run the same script, but use a relationship from the global to account number. This will reset both accounts with the proper counters.
emerywang Posted October 20, 2004 Author Posted October 20, 2004 Thanks, I'll try that. BTW, I've only activated scripts thru the menu, or via a button. Is that what you're thinking of, or is there a way for this script to automatically run? thanks for your help. -Emery
transpower Posted October 20, 2004 Posted October 20, 2004 Have your own Delete button and attach -Queue-'s script to it, in addition to the regular delete command for the record in question.
Recommended Posts
This topic is 7415 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