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.

How to create a "custom" Find

Featured Replies

I want my users to perform a "Find" without them having access to Filemaker's "Find" dialog, for various reasons.

I thought it would be a simple matter of giving them a layout where they enter the Find string, with a button which when pressed triggers a script which performs the Find out of their sight.

But I can't seem to get it to work. Using FM8.5.

Any help would be appreciated.

Make sure the field that holds the find string is defined as global. Then, your script should simply be as follows:


Enter Find mode[]

Set Field [someField;globalSearchString]

Perform Find[]

In both the enter and perform find steps, make sure the "specify find requests" option is unchecked.

  • Author

Hi bobweaver

That seems to work perfectly. Thanks!

Now for the next step I'm stuck at! :

I need the user to be taken to "Layout 1" if a single match is found (with the found record showing), "Layout 2" if more than one matches are found, or "Layout 3" if no match is found.

Could you kindly give me the script steps for the full script needed to achieve this?

Many thanks. PHILIP CAPLAN

Add a "Set Error Capture[on]" step to the beginning of the script so that you won't get an error message if no records are found

Then add the following steps to your script after the Perform Find:

Go to Layout[original Layout]

Go to Layout[Choose ( Min(2;Get ( FoundCount ) ) ; "Layout3" ; "Layout1" ; "Layout2")]

You shouldn't really need the first "Go to" step, but I've noticed a bug in FM 8.5 that prevents this from working if The Go to Layout by calculation step appears immediately after the find.

  • Author

Hi again bobweaver

Many thanks for your speedy reply. I tried what you said, and it worked except that at the end it didn't 'redirect' to the appropriate Layout 1, 2 or 3. It just stayed on the 'original layout'.

I am attaching a screenshot of the script as I entered it, in case I have mistyped anything.

I'd appreciate your further advice, although as it's now nearly midnight here in the UK, I probably won't be able to look at it until tomorrow evening.

Thanks again. PHILIP CAPLAN

NOTE: I've just realized that the attached screenshot shows the last-but-one-step as "Go to Layout 3" -- I did that as a test, and it worked as showing that the script was getting to that point. But I really have "Go to original layout" at that point, and that's where it stays!!

Picture_1.png

Edited by Guest
Silly mistake!

Make sure you change the formula I gave to the exact names of your layouts. I didn't have spaces in "Layout1" "Layout2" etc. Try "Layout 1", "Layout 2" or whatever the actual layout names are.

Also, make sure that you are using the "Layout Name by calculation" option, and not "Layout Number by Calculation."

  • Author

OK. Obviously I hadn't noticed the lack of spaces in Layout1, etc.

I changed the names of my layouts so they match that, and the script now gets to the end. Hooray!

But it always takes the user to Layout2, even when showing 'Found' as 1 or 0 (as well as 2) in the Status Area, and of course it should go to Layout1 and Layout3 respectively in those cases.

Awaiting more help !! : ( Sorry

It was doing that to me too. It appeared that the calculated goto layout doesn't work correctly immediately after a find. That's why I inserted the extra Go to original layout step between the find and the calculated Go to. That fixed it for me. It appears to be a bug in version 8.5. I will report it to FMI as soon as I find the bug report link.

You could also just try the following script:


if [Get(foundcount)=0]

...Go to Layout[Layout 3]

else if [Get(foundcount)=1]

...Go to Layout[Layout 1]

else

...Go to Layout[Layout 2]

end if

  • Author

Right! Now I've got the script working.

Thanks for all your help, bobweaver. PHILIP

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.