5 Replies Latest reply on Jun 18, 2009 10:41 AM by mrvodka

    Extend Found Set

    anicolais

      Title

      Extend Found Set

      Post

      Ok I know this isnt the best way to have built a database but this is how I did it so I was just wondering if someone can give me a pointer on how to create a script. Heres the situation I have 10 tabs each with seperate contacts for the same company. It shows the company in the top then it has a tabbed box that has contact 1 for tab 1 contact 2 for tab 2 etc. It also has follow up date fields. These fields are for the callers to enter when to call the person again next. For example Tab 1 has Follow1 on it then tab 2 has Follow2 on it and so on. What I am trying to do is create a button that when clicked searches all the tabs Follow1, follow2, follow3 ect. at the same time for the current date. Then put them in a layout or something that shows who the caller will be following up with today. Would this be done using extend found set? If so how do you use this command because I dont understand how it really works. Thanks for the help!

        • 1. Re: Extend Found Set
          TSGal

          anicolais:

           

          Thank you for your post.

           

          First, a description of "Extend Found Set".  Perhaps you find a search of all people that have been inactive for the past year.  Now, you want to include with that group of people those who have registered in the last month.  In essence, you are extending the original found set to include another set of people.  Therefore, "Extend Found Set" broadens the existing found set.  Does that make sense?

           

          Since these dates all occur in separate fields, it may be a bit difficult to show a listing, but it is possible.

           

          First, you need to search the records for today's date in any of the 10 tabs.  Assume the follow-up date fields in the ten tabs are titled, Date1, Date2, Date3, ...  , Date10.  Your script would look similar to:

           

          Set Error Capture [On]

          Enter Find Mode []

          Set Field [ Date1 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date2 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date3 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date4 ; Get (CurrentDate) ]

          New Record/Request

           

          Set Field [ Date5 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date6 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date7 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date8 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date9 ; Get (CurrentDate) ]

          New Record/Request

          Set Field [ Date10 ; Get (CurrentDate) ]

          Perform Find []

          If [ Get (FoundCount) = 0 ]

             Show Custom Dialog [ "No records found" ]

             Halt Script

          End If

           

           

          -----

           

          At this point, you have your set of records that need calling today.  Now the trick is to find the caller with the correct tab.  Once found, you want to display a list of names, so the name needs to be put into another field.  Create a new text field "DisplayName".

           

          Assume the contact names in each of the tabs is titled Name1, Name2, Name3, ..., Name10.  Extend the above script as follows:

           

          -----

           

          Go to Record/Request/Page [ First ]

          Loop

             Set Field [ DisplayName ; Case ( Date1 = Get (CurrentDate) ; Name1 ; Date2 = Get (CurrentDate) ; Name2 ; <continue on...> ; Date10 = Get (CurrentDate) ; Name 10; "" ) ]

             Go to Record/Request/Page [ Next ; Exit after last ]

          End Loop

          Go to Layout [ <Layout that includes DisplayName, Company and Phone number> ]

           

          -----

           

          This should get you pointed in the right direction.  Let me know if you need clarification for any of the above steps.

           

          TSGal

          FileMaker, Inc. 

           

           

           

          • 2. Re: Extend Found Set
            mrvodka
              

            You are going to continue hitting the same exact issue over and over. Like I said in your last post, you need to fix your structure by using a related table...

             

            http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&message.id=16929#M16929

             

            You should read this. 1NF

            • 3. Re: Extend Found Set
              LaRetta_1
                

              Hi anicolais,

               

              We would be negligent in our responsibilities (and ethics) as Developers if we did not HIGHLY encourage you to change your data structure now, while it is still in the early stages.  Mr. Vodka is absolutely right.  And you can see by the script provided (having to search through multiple date fields) how tedious it can be when, if these dates are RECORDS in a related table, your script would change to be simply:

               

              Enter Find Mode [ ]

              Set Field [ yourDateField ; Get ( CurrentDate ) ]

              Set Error Capture [ On ]

              Perform Find [ ]

              ... 

               

              You see how easy it could be? :smileyhappy:

              • 4. Re: Extend Found Set
                anicolais
                  

                Honestly I would change it but the data is already being used live on IWP and this is actually the final product of the database I am just adding stuff to it. I was going to use a relational database in the beginning and was trying to but then I couldnt figure out how to do this. I am just getting into my MIS courses at school right now and am learning new things everyday from my work which is what I'm doing this database for. Is there any good articles on relational databases that you guys know of?

                 

                Thanks!