4 Replies Latest reply on Jul 1, 2011 11:48 AM by StephenLabuda

    Newbie question



      Newbie question


      Hello all,

      I am brand new to Filemaker and I have a question. I thought it would be easy, but I can't find a clear explanation anywhere by searching the forum, google, etc.

      I have setup a very simple database.

      One table contains a list of phrases (a lot of them).

      The second table contains a list of keywords.

      I would like to setup a script / find operation that will search through the phrases table and find any phrases that contain a keyword from the in the keywords table.

      I see how I can setup a script to find records if I manual setup the criteria as =*keyword1* and then setup another criteria =*keyword2*, but I can't figure out how to setup the criteria so that it just looks at the keywords table instead of setting up each keyword individually.

      Please advise.

      Thanks, Stephen

        • 1. Re: Newbie question

          How have you set up your "list of keywords"?

          One record for each keyword or do you have multiple keywords in the same field?

          If in the same field, how are they entered in this field?

          A script can build multiple find requests using this basic format:

          Enter find Mode[]
          Set field [Table::field ; //criteria goes here]
          new Record/Request
          Set Field [Table::field ; //different criteriea here]
          //repeat until all requests have been created
          Set Error capture [on]
          Perform Find []

          The trick will be transporting the entire list of keywords from the first layout to the second so that the script can build these requests. How that works will depend on how the keywords are recorded in the "second table".

          • 2. Re: Newbie question

            I just have each keyword in a new record in the "Keywords" table. I have each phrases in a individual record in the "Phrases" table.

            My plan was to have the keywords table so that I could always add or remove a keyword from the search criteria. In excel, I could setup a query for this, but I don't see how to filter the "phrases" table so I am only showing phrases that contain a keyword from the "keywords" table.

            • 3. Re: Newbie question

              Using what you have, this script would use the found set from the keywords table to filter your phrase list. (Note that you don't have to create and delete records in this table to change the keyword filter, you can include and omit existing records to make up different found sets of records instead.)

              Go To Record/Request/Page [First]
                 Set Variable [$KeywordList ; Value: List ( $KeywordList ; KeywordTable::Keyword ) ]
                 Go To Record/Request/Page [next ; exit after last]
              End Loop
              Go to layout [Phrases]
              Enter Find Mode[] // clear the pause check box
                 Set Variable [$I ; Value: $I + 1]
                 Set Field [Phrases::Phrase ; GetValue ( $KeywordList ; $I ) ]
                 Exit Loop If [$I ≥ ValueCount ( $KeywordList )
                 New Record/Request
              End Loop
              Set Error Capture [on]
              Perform Find[]
              Sort [Restore ; No dialog ] //optional step here

              It may also be possible to use a calculation field to break up your phrase into a list of keywords. Then a relationship between a text field that stores the list of keywords separated by returns could be used with Go To Related Records to pull up the desired phrases or they could be displayed in a portal.

              • 4. Re: Newbie question

                Can I just hire you to build this for me?