joemuskrat Posted January 13, 2006 Posted January 13, 2006 I have a loop script problem in FMP 6 Dev. The Status field indicates whether or not a client has paid (either "paid" or "current"). In order to bill just the "current" records for a particular client, I have the following script to eliminate the"paid" records: Loop go to record/request/page [first] If (status="paid") omit record Go to record/requestpage [next, exit after last] End if End loop If I have multiple "paid" records and only 1 "current" record, the script works OK. Howver, with musltiple "paid" and multiple "current" records, the script hangs and I have to manually end the loop. What am I doing wrong?
Breezer Posted January 13, 2006 Posted January 13, 2006 (edited) Do you really have to use a loop? What would be wrong with: Go to Layout ["LayoutWithClient"] Go to Field ["ClientName"] Set field [gClient = Status(currentFieldContents)] Enter Find Mode[] Set Field [ClientName = gClient] Set Field [status = "Current"] Perform Find [] If Status (CurrentFoundCount) = "0"] Show Message ["No records for this client are current"] Show All Records Go To Layout [original layout] Else Go to Layout ["Other layout"] NOTE: gClient is a global text field or you can use your client key field ID. Edited January 13, 2006 by Guest
stanley Posted January 13, 2006 Posted January 13, 2006 Joe: In your original example, you've put Go To Record [first] inside of your loop, so it keeps going to the first record. It should look like this: Go To Record/Request[first] Loop ... your processes ... Go To Record/Request[next, exit after last] End Loop -Stanley
sbg2 Posted January 13, 2006 Posted January 13, 2006 Also note the Omit Record step "Leaves the current record out of the found set and places you on the next record in the table". If you then tell it to Go To Record[next] you have skipped a record!
joemuskrat Posted January 13, 2006 Author Posted January 13, 2006 I've tried Beezer's method and couldn't get it to work. I then placed go to record/request/page [first] before the loop and it also doesn't work. I want to eliminate the "paid" records. How else can I do it without using omit record?
joemuskrat Posted January 13, 2006 Author Posted January 13, 2006 OK, I've figured it out, thanks to Breezer. Instead of using status(currentFieldContents), I copied the clinet ID and pasted it in during Enter Find mode, rather than using Set Field again. Set Field is more elegant than copy and paste, but this works.
Recommended Posts
This topic is 6891 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