January 13, 200620 yr 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?
January 13, 200620 yr 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, 200620 yr by Guest
January 13, 200620 yr 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
January 13, 200620 yr 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!
January 13, 200620 yr Author 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?
January 13, 200620 yr Author 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.
Create an account or sign in to comment