October 19, 200421 yr 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.
October 19, 200421 yr 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.
October 20, 200421 yr Author 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
October 20, 200421 yr Have your own Delete button and attach -Queue-'s script to it, in addition to the regular delete command for the record in question.
Create an account or sign in to comment