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.

Combine an If with a search

Featured Replies

Since I have now taken a intro programming course I want to start using some of what I learned with Filemaker.

I want to perform a script that will determine if the production status is unknown then omit that record or records. Here is what I have written.

Enter Find Mode[]

Go to Field["Prod Status"]

Perform Find [Restore]

If ["ProdStatus" = "unknown"]

omit record

End If

My problem is that it will only omit one record at a time.

So I am thinking I need to do a loop of some kind. Where it would go through each record to see if the if statement is true.

How would I do a while loop in Filemaker?

Paul

This is confusing to Filemaker people. Usually, you wouldn't need to do this at all. Your original find should have the ommission criteria built into it. Enter find mode manually, type the criteria you need into your ProdStatus field, then make a new find request, type "unknown" into ProdStatus and click the "omit" box. The find will display the found set minus the unknowns in one fell swoop. No need to get a script involved at all. You can set up pretty complex finds this way, with dozens of separate request.

If you decide that you will need to do this frequently, run the find manually, then make a script with a single Perform Find command ("restore" option checked). When you click OK, you'll get a keep/replace prompt. Click Replace and your new one-line script will memorize the manual find you just made, however complex. Then it can be run again at the click of a button. You can also call upon this find in other scripts by running this new one-line script as a subscript.

You can do loops in FM's scripting, but as you've described the situation, I see no need for one.

Steve Brown

Hi Paul and Steve,

If really this search is designed to be a frequent search, you'd better look for relationships here, then perform a GoToRelated records using a boolean calculation at right side Case(status="unknown",0,1) and a constant field which you will populate with 1.

pkudrle said:

How would I do a while loop in Filemaker?

Paul

BLAST! Where is the code? It disappeared after my first attempt!

Here is it again:

Loop

Set Field [ g_Temp_numb, g_Temp_numb +1 ]

Enter Find Mode

Set Field [ ID_Order, g_Temp_numb ]

Perform Find

Exit Loop If [ Status( CurrentFoundCount) = 0 ]

End Loop

Or you can use Goto Next Record with Exit if last

before End Loop

HTH

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.