April 11, 200718 yr 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
April 11, 200718 yr Author 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!
April 11, 200718 yr 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
April 11, 200718 yr Author 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?
April 11, 200718 yr I have built an example db which works well and finds 'march'. Cmd-1 to execute the script. -jens search.zip
April 11, 200718 yr Author 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!
April 17, 200718 yr 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
April 18, 200718 yr Author 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!
Create an account or sign in to comment