May 5, 200520 yr FMP7: I am trying to perform a find based on find criteria input through field displayed in a custom dialog box. The Filemaker help files have this to say: #This script begins by entering Find mode. Enter Find Mode [] #The custom dialog box solicits the name and city of the customer to be found. Show Custom Dialog ["Find a customer"; "Enter the name and city of the customer below:"; Customers::Name; Customers::City] #In this example, button 1 is "OK" and button 2 is "Cancel." If [Get (LastMessageChoice) = 1] #If the user selects button 1, the Find is performed. Perform Find [Restore] End If The problem is that I don't know what find request to use. In other words how do I get the input fields in the dialog box to be used in the search? I already tried [Restore FieldName:=] and [Restore FieldName:==] but (of course) that just returns the empty fields I also tried performing the find using the Perform Find script step without the "Specify" (i.e. [Restore]) checked and that returned no records. Can anyone help? Thanks
May 5, 200520 yr Author OK I got it. You do not do a restore on the perform find step (the help file is inaccurate). However now my problem is that I automatically want to put a qualifier before the find (?) which I can only do by pulling up Macintosh's character palette and putting it in the input field of the dialog box...anyone know a way I can automatically (and preferably invisibly) prefix the input? Another related question: Is there any way to build up multiple finds ("OR" rather than "AND" requests) using each of the three available input fields querying three different fields in the layout (i.e the Find request would look like this: ?InputField1 OR ?InputField2 OR ?InputField3 Thanks
May 5, 200520 yr Author Sorry the greater than or less than symol appeared in the above example as a question mark rather than the symbol I wanted
May 5, 200520 yr Author OK I managed it myself by playing around: the script looks like this: Enter Find Mode[] Show Custom Dialog[WINDOWTITLE:WINDOWTEXT:TABLENAME::FIELDNAME] If[Get (LastMessageChoice)=1] Insert Calculated Result [select;TABLENAME::FIELDNAME;"?"&TABLENAME::FIELDNAME Perfrom Find[] End If Note on the "Insert Calculated Result step" the Input field from the custom dialog box has already been inserted BY the custom dialog box, so when you insert the calculated result it looks at that field, calculates the result and re-inserts the calculated result into that same field with whatever modification you want as stipulated by the calculation. Probably as clear as mud, but the important thing to remeber here is that FIELDNAME in the script fragment above refers to the same field in all cases.
May 5, 200520 yr I believe that for this type of complexity you would be better served by creating a special layout for constructing the find requests, and using global fields (in Browse mode) for user input. Instead of Custom Dialog, open a new window and go to that layout. You can use a single global repeating field to input your OR criteria. You can also put buttons on the layout defined to insert special find symbols, such as the 'greater than or equal' symbol. When the user is done, run a script that goes to Find mode and sets the searched field to the first repetition of the global. If needed, the script can create a new request and set the searched field to the second repetition, and so on. You could even reserve one of the repetitions for omit. BTW, you can use option-period and option-comma to type the 'greater than or equal' and 'less than or equal' symbols.
Create an account or sign in to comment