7 Replies Latest reply on May 29, 2009 3:14 PM by TSGal

    If field has data - find it

    Terri

      Title

      If field has data - find it

      Post

      I am trying to write a script that does the following:

       

      Info:

      Field1 = Trip Name

      Field 2 = Corresponding Trip Name

      Layout = Trip Itinerary

       

      What I need it to do:

      If Field 2 has a trip name in it - do a search for THAT Trip Itinerary

       

      I am assuming this needs to be a calculation within the script but I am not exactly sure how to write that. 

       

      Any help is appreciated.

       

       

        • 1. Re: If field has data - find it
          mrvodka
            

          Not sure what you are looking for...

           

          Taking a guess here but if you right click the field you can choose 'Find Matching Records'

          • 2. Re: If field has data - find it
            Terri
              

            Hmm, that doesn't seem to work at all. It actually seems to work in the opposite. If I chose show all records and then do the right-click and find matching records it brings up the opposite records that I want. Not sure what I am doing there.

             

            In any case, I want this to be a script that takes me to the layout and sorts to find the records that I want. The trouble I have with the script is I cannot tell it what to sort for, FileMaker has to grab that info from the field that I am clicking on.

             

            Hope that helps to explain it a little better.

             

            Thanks for your idea!

             

            Terri

             

            • 3. Re: If field has data - find it
              mrvodka
                

              Sorry I am still unclear on what you want.

               

              A layout is based of a table occurrence, not a particular field or specific data in a field.

               

               

              • 4. Re: If field has data - find it
                Terri
                  

                I just posted another question that I hope clarifies it a bit. I know since I am new at this my vocabulary isn't always right but yes, I have a table that has the all the fields and then I have a layout that is comprised of fields from this table (and obviously there are records that input data into these fields). My new question is this:

                 

                I am using FMP 9 - I am trying to write a script that will perform a find by grabbing data from one field and putting it in another. Currently my script looks basically like this:

                 

                Enter Find Mode

                Set Field [Catalogs::Field A; Field B]

                Perform Find

                 

                Field A and B are in the header of my layout. When I execute the script there are no found records (which there should be) and my cursor is in the body of the layout in a totally different field.

                 

                Do Field A and B have to be in the body? What am I doing wrong?

                • 5. Re: If field has data - find it
                  mrvodka
                    

                  Set Variable [ $field; Field B ]

                   

                  Enter Find Mode []

                  Set Field [Catalogs::Field A; $field ]

                  Perform Find []

                   

                   

                  It need to capture what the value was in a variable prior it entering find mode where the value will not exist since its no longer in browse mode...

                  • 6. Re: If field has data - find it
                    Terri
                      

                    This is what my script looks like now - exactly:

                     

                    Set Variable [$Field; Value:Catalog Pagination::Corresponding Insert Media Code]

                    Enter Find Mode []

                    Set Field [Catalog Pagination::Media Code; $Field]

                    Perform Find []

                     

                    Corresponding Insert Media Code is the field I want it to pick up -

                    Media Code is the place I want that info dropped. 

                     

                    Still no luck. 

                    • 7. Re: If field has data - find it
                      TSGal

                      Terri:

                       

                      Thank you for your posts.

                       

                      It looks like everything is set up properly.  What you may want to do is make sure you are getting information from "Corresponding Insert Media Code".  Therefore, we'll add a step to the script to make sure you are getting what you expect.

                       

                      Set Variable [ $Field ; Value: Catalog Pagination::Corresponding Insert Media Code ]

                      Show Custom Dialog [ $Field ; "Corresponding Insert Media Code = " & $Field ]

                      Enter Find Mode []

                      Set Field [ Catalog Pagination::Media Code ; $Field ]

                      Perform Find []

                       

                      That is, after grabbing the Corresponding Insert Media Code, I'm displaying it to make sure there is a value.  Then, that value will be placed in the Media Code field prior to the Find.  After the Find, you can also pull down the Records menu and select "Modify Last Find" to see what search value is in the Media Code field.

                       

                      Continue to keep us updated

                       

                      TSGal

                      FileMaker, Inc.