Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6620 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted (edited)

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!
Posted

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."

Posted

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

Posted

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

This topic is 6620 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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