Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

loop problem

Featured Replies

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?

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 by Guest

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

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!

  • 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?

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.