4 Replies Latest reply on Feb 3, 2010 7:28 PM by Diveboss

    Is it possible to set field to = the Search Criteria?

    Diveboss

      Title

      Is it possible to set field to = the Search Criteria?

      Post

      I have a search script that, if found count = 0, the options are: Try Again, Cancel, or Add. What I would like to do is take the data entered for the search and pass it to and set it as the data in a specified field of the new record. The search field is global; [FIELD1 & " " &  FIELD2 & " "  &  FIELD3 & " "  & FIELD4 & " " & FIELD5]. If I search for "ABC" and I do not get a match and I select ADD I want to set FIELD1 = "ABC" in the newly created record. Is this possible in FM Pro 8.5 V2?  Thanks in advance for any help.

        • 1. Re: Is it possible to set field to = the Search Criteria?
          hbrendel
             Input the search criteria in a global field. In your Find Script, first empty this global, then pause the script. After the input, perform the find behind the scenes. When it comes to adding a record, set FIELD 1 to the content of the global.
          • 2. Re: Is it possible to set field to = the Search Criteria?
            Diveboss
              

            Thanks for the response, it did get me to approach the problem from a new angle, but I guess I do not understand search all that well.

             

            I created a global field that is used for the search criteria input, but the field I wish to search is not the global field. How do I use the global data to search the calculated field  [field1] & [field2] & [etc.] I would copy and paste my script here but this site apparently does not allow pasting to the message base.

             

            I was able to set [field1] = [global_Search_Criteria] when adding a new record using the script so now I just need to know how to take the search criteria and have is seach the correct field.

             

            Any additional help is appreciated.

             

             

             

             


            • 3. Re: Is it possible to set field to = the Search Criteria?
              philmodjunk
                

              You can paste text to this forum, though you may have to click the clipboard icon with the w in order to do so. You can't, however, copy script steps directly from filemaker and paste them. To copy/paste a script, you can print a PDF of your script and copy the text from the PDF or you can use filemaker advanced to create a database design report and copy the text from there.

               

              To use a global field in a scripted find:

               

              Enter Find Mode[]

              Set field[YourTable::YOurfieldyouwanttosearch; YourTable::YourGlobalField]

               

              You can also include operators like:

               

              Set field[YourTable::YOurfieldyouwanttosearch; "==" & YourTable::YourGlobalField]

              • 4. Re: Is it possible to set field to = the Search Criteria?
                Diveboss
                  

                Thanks,

                 I played a bit after my last post and figure out where I needed to correct my script. When you work seven days a week, it doesn't leave much time to think. I write these apps all the time, use them and forget what I did to make it work. Then I get an idea for another app and I have to research my older apps or read to find out what I need to do.