9 Replies Latest reply on Jan 14, 2010 11:40 AM by joeu

    Find using existing data

    BGumble

      Title

      Find using existing data

      Post

      I'm trying to create a button that will automatically preform a Find using existing data in specific fields from the record the user is currently viewing.

        

      For example if the field "Paper Type" has the data "Gloss" entered in it and the field "Weight" has "33" and the field "Price" has "$200" when button is pressed it will search all records for those entries in those fields.

       

      There are no restrictions to the data that could be put in these fields - "Price" could have any number put into it.

       

      Just trying to make this simplified so that the end user does not have to preform a Find by actually typing - lol.

       

      Hope I explained this well enough - thanks for any help. 

        • 1. Re: Find using existing data
          Orlando
            

          Hi BGumble and welcome to the forum,

           

          You want to set up a script to set the field values in a Variable and then in Find Mode input the values into the field and perform the find. Along the lines of the following:

           

          #

          Set Error Capture [On] 

          Set Variable [ $SearchPaperType ; TABLE:: Paper Type ] 

          Set Variable [ $SearchGloss ; TABLE:: Gloss ] 

          Set Variable [ $SearchWeight ; TABLE:: Weight ] 

          Set Variable [ $SearchPrice ; TABLE:: Price ] 

          #

          Enter Find Mode [] // Deselect 'Pause' 

          Set Field [ TABLE:: Paper Type ; $SearchPaperType ]

          Set Field [ TABLE:: Gloss ; $SearchGloss ]

          Set Field [ TABLE:: Weight ; $SearchWeight ]

          Set Field [ TABLE:: Price ; Type ; $SearchPrice ]

          Perform Find [] 

          #// Check result and if no records found alert user.

          If [ Get ( FoundCount ) = 0 ]

          Show Custom Dialog ["Message" ; "No Records Found."]

          Enter Browse Mode []

          End If 

           

           

          And this should do the trick, there is also an extra part at the end to alert the user if nothing is found.

           

          I hope this helps.

          • 2. Re: Find using existing data
            BGumble
              

            Orlando,

             

            This looks like exactly what I need - however I'm having a bit of trouble.

             

            In the "Set Field" area I am not able to do what you have shown. I don't know how to get it to add the "; $SearchPaperType" on to that line.

             

            It allows me to specify the TABLE and field but that is all.

             

            Don't know what I'm doing wrong. 

             

             

            • 3. Re: Find using existing data
              mrvodka
                 You enter it in the "Calculated Result" section. It is below the "specify target field"
              • 4. Re: Find using existing data
                BGumble
                  

                Perfect!

                 

                Thank you for your help!!! 

                • 5. Re: Find using existing data
                  joeu
                     I want to do this too but when I'm in "calculated Result" I keep getting an error message "an operator is expected here" and can't get by this.
                  • 6. Re: Find using existing data
                    mrvodka
                      

                    Not knowing what you are typing in there I can try to take a stab in the dark. Perhaps you are not using & to concatenate fields and strings?

                     

                    If not, post your calculation.

                    • 7. Re: Find using existing data
                      joeu
                        

                      I use FM Pro 10

                       

                      I'm trying to duplicate a previous post that gave the script below.  But I can't seem to enter them. I don't see these options and don't know how to do this manually.  I'm a newbie only a month old!!

                      TIA

                       

                      j0e

                       

                      =======================================

                      #

                      Set Error Capture [On] 

                      Set Variable [ $SearchPaperType ; TABLE:: Paper Type ] 

                      Set Variable [ $SearchGloss ; TABLE:: Gloss ] 

                      Set Variable [ $SearchWeight ; TABLE:: Weight ] 

                      Set Variable [ $SearchPrice ; TABLE:: Price ] 

                      #

                      Enter Find Mode [] // Deselect 'Pause' 

                      Set Field [ TABLE:: Paper Type ; $SearchPaperType ]

                      Set Field [ TABLE:: Gloss ; $SearchGloss ]

                      Set Field [ TABLE:: Weight ; $SearchWeight ]

                      Set Field [ TABLE:: Price ; Type ; $SearchPrice ]

                      Perform Find [] 

                      #// Check result and if no records found alert user.

                      If [ Get ( FoundCount ) = 0 ]

                      Show Custom Dialog ["Message" ; "No Records Found."]

                      Enter Browse Mode []

                      End If 

                       

                       

                      And this should do the trick, there is also an extra part at the end to alert the user if nothing is found.

                       

                      I hope this helps.


                        -- Orlando
                      FileMaker 9 Certified Developer

                       


                      • 8. Re: Find using existing data
                        philmodjunk
                          

                        I gather you are having trouble entering the script steps...

                         

                        Many new users get confused the first time they try to add Set Field to a script. See the following link for step by step instructions: (Scroll down towards the end of the thread.)

                        Selecting an "All" option with checkboxes

                         

                        Likewise, set variable adds the "value:" text for you. You'll use the specify button to type in "$SearchPaperType " and then either type in "TABLE:: Paper Type" or click the specify button in the popup to select this field from the list of fields defined in your database in the specify calculation dialog.

                         

                        Also note that you'll have to replace "TABLE:" with the name of  a table in your database, and use a field name from your database in place of "Paper Type". There's also an extra space between the second colon to keep this forum from inserting an undesired emoticon (TABLE::Paper Type). In your database, you'll leave out the space.

                         

                        Done correctly, each set variable line should look like this, but with your table and field names instead of the ones Orlando has posted:

                         

                        Set Variable [ $SearchPaperType ; Value: TABLE:: Paper Type ]

                        • 9. Re: Find using existing data
                          joeu
                            

                          Phil,

                           

                          "you're the man" !!!

                           

                          Thanks...it finally sunk-in and I got it to work!!

                           

                          j0e