1 2 Previous Next 17 Replies Latest reply on May 17, 2013 9:45 PM by philmodjunk

    Find in a Show Custom Dialog



      Find in a Show Custom Dialog


           If would like to use a show custom dialog box to per form a find. This is what I ahve so far:


           Enter Find Mode

           Show Custom Dialog (clientID; transactionType; paid) Note: paid is a Boolean field - "yes" "no"

           Perform Find


           It does a find, but does not pull the correct records.

        • 1. Re: Find in a Show Custom Dialog

               Show Custom Dialog [.... //specify a global field for the input]
               enter Find Mode []
               Set Field [YourTable::YourField ; YourTable::GlobalFieldFromCustomDialog]
               Set Error Capture [on]
               Perform find[]

               For more examples of scripted finds, you may want to see this thread: Scripted Find Examples

          • 2. Re: Find in a Show Custom Dialog

                 OK. Thanks.

            • 3. Re: Find in a Show Custom Dialog

                   Ooops ... I tried it several more times and I do not get the right result after all. I can perform this find in the regular fashion, I just thought it would be nice for the other users to engage a dialog box that had instructions so that they would not not have to remember what to enter in each field. I do not understand the use of the global field.

              • 4. Re: Find in a Show Custom Dialog

                     The script example given will work. What is happening that tells you that it is not working?

                     Did you specify a field with global storage?

                     Is it the correct data type?

                     A more sophisticated version of this script can detect whether or not Cancel was clicked and it can then not perform the find if that button was clicked in the dialog.

                • 5. Re: Find in a Show Custom Dialog

                       The find is simple:

                       1) Find the client (type in the ID #)

                       2) Find the Transaction type (for example, type in "Buy")

                       3) Find whether there has been a payment (type in "No" or "Yes")

                       None of these three fields have global storage options selected.

                       When I perform the find in the usual manner I get four records. When I try to use the dialog box, it gives me 2 records, and they do not match the criteria.

                       So, I do not understand why, if I get the records in the usual sort manner, why do I have to create separate fields with global storage options and how could I pull up the correct records.

                       Does not a global storage field mean that the same value is in every record in the database?

                  • 6. Re: Find in a Show Custom Dialog

                         You would not specify global storage for your existing fields. You add new fields to those you already have that serve as temporary storage locations for your search criteria.

                         Searching with criteria entered into three fields instead of 1 is new information. For this method to work, you'd to add 3 new global fields instead of just one. Since the show custom dialog can have up to 3 input fields, that will still work for this method, though I'd use New window to open a new window for this instead of show custom dialog so that I can use value list formats on the global fields to make it easier for the user to correctly enter the needed search criteria.

                         Sounds like details aren't quite right in your script. Please post the exact script that you created.

                         To post a script to the forum:

                    1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                    3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
                    5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
                    7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
                    • 7. Re: Find in a Show Custom Dialog

                           This script does not pull up any records:

                           Show Custom Dialog [ Title: "Paid Status"; Message: "Enter Client #"; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” ,
                           Commit: “No”; Input #1: Orders::globalClientID , "Enter Client #"; Input #2: Orders::globalTransactionTypeID , "Enter \"Buy\""; Input #3:
                           Orders::globalPaid , "Paid?" ]
                           Enter Find Mode [ ]
                           Set Field [ Orders::globalClientID ]
                           Set Field [ Orders::globalTransactionTypeID ]
                           Set Field [ Orders::globalPaid ]
                           Set Error Capture [ On ]
                           Perform Find [ ]

                      • 8. Re: Find in a Show Custom Dialog

                             Your Set Field's appears to be unfinished, since it has only indicated one parameter for each, when it needs two.

                             The example PhilModJunk gave was:

                             Set Field [YourTable::YourField ; YourTable::GlobalFieldFromCustomDialog]

                             The first field being the one you want to search on.  The second field being what the user inputted into the dialog box.

                        • 9. Re: Find in a Show Custom Dialog

                               OK OK wait... so the Input Fields should be global.

                               The fields being searched (as you've shown in your script) are the same fields. I assume that these are NOT the fields you want searched.

                               You should have Fields in your table as follows:

                               Orders::gClientID (the field for "temporary storage") where its contents are used as the find criteria for Orders::ClientID

                               Orders::gTransactionTypeID … Orders::TransactionTypeID

                               Orders::gPaid … Orders::Paid


                               Then, so that the global fields are blank for the next instance:


                               Set Field ( Orders::gClientID ; "" )

                               Set Field ( Orders::gTransactionTypeID ; "" )

                               Set Field ( Orders::gPaid ; "" )


                               Global fields are storage fields in which the contents are the same for all records. A good example of this would be Orders::gCurrentDate. I have a whole table full of global fields, and they don't need to be related in order to be referenced.

                               Hope that helps


                          • 10. Re: Find in a Show Custom Dialog

                                 What I do is use an If block at the start of the script that encloses the set field steps that clear the global fields before show custom dialog or New Window is used to display them. The if block checks the value of the script parameter and only clears the fields if a specified value is returned by Get ( ScriptParameter ). That then gives me both Find and Modify Find capability in a single script. I can set up two buttons and have them pass different parameters to the same script.

                                 My Known Bugs List Databse contains an example of that type of script.

                            • 11. Re: Find in a Show Custom Dialog

                                   Thank you all. I should have more closly read the syntax for the Set Field function. It works now.

                              • 12. Re: Find in a Show Custom Dialog

                                     Well, once again I spoke too soon. It is still not returning the correct results. This is the current version of the script:

                                     Show Custom Dialog [ Title: "Paid Status"; Message: "Enter Client #"; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “No”; Input #1: Orders::globalClientID ,
                                     "Enter Client #"; Input #2: Orders::globalTransactionType , "Enter \"Buy\""; Input #3: Orders::globalPaid , "Paid?" ]
                                     Enter Find Mode [ ]
                                     Set Field [ Clients::__pkClientID ; Orders::globalClientID ]
                                     Set Field [ Orders::transactionType ; Orders::globalTransactionType ]
                                     Set Field [ Orders::paid ; Orders::globalPaid ]
                                     Set Error Capture [ On ]
                                     Perform Find [ ]

                                • 13. Re: Find in a Show Custom Dialog

                                       Given the fact that you are specifying search criteria in two different tables, things get a bit more complicated and the relationship linking the two tables plays a role as well.

                                       Presumably, you have this relationship:

                                       Clients::__pkClientID = Orders::_fkClientID

                                       Is the layout where you perform this script based on Clients or Orders?

                                       If the layout is based on clients, this script should find all client records with the specified client ID and at least one related record with the specified criteria in Orders. If the layout is based on orders, (as it should be, if I understand correctly what you want here), it should find all orders records linked to the specified client with the specified orders criteria.

                                       And "not returning the correct results" doesn't tell us much. What INCORRECT results do you see after running the script?

                                  • 14. Re: Find in a Show Custom Dialog

                                         Yes, Clients::__pkClientID = Orders::_fkClientID

                                         Script based on Orders

                                         The script retruns the correct results for clients and transaction type, but not for the paid field. I in put "No" in the paid field but in addition to the 6 records that are unpaid, it returns 3 records that are paid.

                                    1 2 Previous Next