Jump to content
Sign in to follow this  
barryfh

Problem using Find in a script with custom dialog

Recommended Posts

Hello,

I have a button with a script that is intended to perform a Find using a value entered into a custom dialog.

This script generates an error alert rather than performing the Find.

As shown in the screen captures in the attached zip file, 1) the input field is assigned to button 1 (default; rightmost) in the custom dialog, 2) I am typing a correct value ("March") in the custom dialog, and 3) if I type "March" into the target field that is referenced in the Input Fields tab in the Custom Dialog dialog, the Find functions properly.

What have I done improperly and what is necessary to correct it so that the script will perform the Find after entering a search term in the custom dialog?

Many thanks in advance!

P.S. If the zip file contains any files/folders that have a name beginning with a period or slash, please ignore and trash them. Regrets for any inconvenience.

Screen_captures.zip

Share this post


Link to post
Share on other sites

Here is some additional information.

FM Help contains an example of using a script, custom dialog, and input fields to perform a Find. In the example, the script line Perform Find includes [Restore].

This means that the example assumes a Find Request has been specified in the Edit Script window for the Perform Find command; otherwise, the example's script line would be "Perform Find []" rather than "Perform Find [Restore]."

I therefore specified the Find Request as shown in the attached screen capture.

I have run the script after having deleted the Find Request specification. Instead of displaying an error alert, the script returns to my original layout.

How can I fix this so that it works properly?

Thanks in advance!

Specify_find_request.png

Share this post


Link to post
Share on other sites

The option 'restore' in the perform find script step means that you perform an older query saved in this script. Surely not what you intend to do.

- jens

Share this post


Link to post
Share on other sites

Jens,

Thank you for replying.

If I uncheck the "Specify find requests" checkbox for the Perform Find command in the Edit Script window, then the [Restore] is removed from the Perform Find command.

I then execute the script, type "March" (without quote marks) in the custom dialog, and the script returns to my original layout without having found the 24 records for which the Month field contains March.

Do you have a different suggestion that would solve this problem?

Share this post


Link to post
Share on other sites

Hello again.

Correct, your script works properly and it led me to dissect my script, removing one line at a time until it worked properly. Then I added back the lines, tweaking until it finally worked properly.

Jens, thank you very much for your time, help, and patience!

Share this post


Link to post
Share on other sites

Barry--

I'd like to take a minute to discuss your custom dialog. When you set a custom dialog to use a data field, you are going to actually change the contents of that field. So whatever record was on display at the time you executed this got changed to "March". If you create a global field gSearch and use it in this dialog, you can then use a script to:

Enter Find Mode

Set Field[Event; gSearch]

Perform Find[]

David

Share this post


Link to post
Share on other sites

David--

Thanks for your message.

Actually, following Jens' advice above, the custom dialog works perfectly. FileMaker uses the value I enter in the custom dialog as a search term rather than changing the contents of that field.

Cheers!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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