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.

Scripted alternate to find inconsistent

Featured Replies

As a building block for a larger script meant to replace a "find":

Go To layout

Show all records

Go to Record/Request/Page [First]

If [Managers::reference = "yes"]

Omit Record

End If

Loop

Go to Record/Request/Page [Next, exit after last]

If [Managers::reference = "yes"]

Omit Record

End If

End Loop

Show Omitted Only

A "find" for all records where reference = "yes" yields 20 records in the found set.

Using the above script yields 15 records in the found set.

What am I missing in this script?

Thank you in advance:)

You are skipping records: when you omit a record, you already are on the next record.

When two Yes records are consecutive, you are keeping the second one because you always Go To Next Record at the beginning of the Loop, even if it's a record that hasn't been tested yet by the If because of the Omit.

Try:

Go To layout

Show all records

Go to Record/Request/Page [First]

Loop

If [Managers::reference = "yes"]

Omit Record

Else

Go To Record Next [Exit After Last]

End If

End Loop

Show Omitted Only

Of course this is assuming there aren't any records that contain words that begin with "yes", but aren't exactly equal to "yes" - that would further increase the discrepancy.

BTW, what's the purpose here? A find is much faster and efficient since it's using the field's index.

  • Author

I will give this a shot tomorrow -- thanks.

The purpose is to loop through a set of records, omitting by several criteria via several loops and to show omitted -- rather "finds" which may ask the user to continue, cancel, etc. if the "find" does not meet the criteria -- ie. to have script that will finish no matter what.

I can see how having unneeded dialog boxes can be annoying. Michael's right though, this should be done as a Find.

Your problem can be solved by using other Filemaker script steps and functions to customize error messages or supress them entirely.

Check Out:

Allow User Abort [Off]

Set Error Capture[On]

Show Custom Dialog[]

Get(LastMessageChoice)

Get(LastErrorMessage)

  • Author

That's great -- I wonder if you could provide an example that I could adapt to my needs?


Set Error Capture [ On ] 

Enter Find Mode [  ] 

Set Field [ Invoice::Managers::reference; "Yes" ] 

Perform Find [  ] 

If [ Get ( LastError ) ] 

      Show All Records

      Show Custom Dialog [ Message: "Nothing found"; Buttons: “OK” ] 

End If 

Set Error Capture [ Off ] 

E.g.

--sd

  • Author

That's great but I think your example will generate a dialog box requiring the user to respond, to select "OK"-- the point of the omit script is to avoid this; especially in the case where there are multiple (criteria) loops -- as I understand this example, the user would be required to respond to each such prompting when no records are found for each loop/step of the script.

Do I misunderstand?

Edited by Guest

Hopefully are you not pursuing something as silly as the above?? Lets just say it's something dedicated to:

http://www.fmforums.com/forum/showuser.php?uid/34454/

Who apparently gets lost in her relational graph, so the less the better :,)

To your question - remove the dialog and make the request:


Set Error Capture [ On ] 

Enter Find Mode [  ] 

Set Field [ Managers::reference; "Yes" ] 

Perform Find [  ] 

Set Error Capture [ Off ] 

I'm not getting the reason why it has to be looped, unless you inside the building of the request needs to fill several fields in an AND'ed mode, but then is it just to use a series of the same set field step ushered from field to field by Go To Next Field ... but the dependency of a facilitating layout providing enough fields, is not the strongest technique known to mankind.

Explain yourself here!

--sd

build.jpg

Requestbuilder.zip

Edited by Guest
Had great fun ... being silly!

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.