6 Replies Latest reply on Feb 20, 2012 4:05 PM by rickmarqusee

    Combining 2 scripts into one

    rickmarqusee

      Title

      Combining 2 scripts into one

      Post

      I have a script that selects "records that occur today."  I also have another script that selects records "that have not been completed."

      How do I write a script that both selects records that occur today and are not completed?

      Dual_script.jpg

        • 1. Re: Combining 2 scripts into one
          philmodjunk

          You received an answer to your post in another part of the forum. Did it work for you?

          If not, please describe the two different relationships on which the above two uses of Go to related records are based and I'll provide a more detailed example of how you can set up either a scripted find or a new relationship that matches by today's date and by what ever data identifies a record as incomplete.

          • 2. Re: Combining 2 scripts into one
            rickmarqusee

            No it didn't (I was successful, however, in moving to the correct location in the forum to post my problem).


            I suspect that one of my problems is my inability to properly describe what the scripts do in the data base.


            I’ve adapted the FM Pro 11 starter solution “To Do List” in which either selecting the script “Show Today’s Items” or “Show Incomplete Tasks,” will produce a report with a number of fields, showing either tasks for today (complete or incomplete) or tasks not-completed (for all days).  I would like to design a script that produces a report showing only incomplete tasks for today only.

            • 3. Re: Combining 2 scripts into one
              philmodjunk

              Identifying the starter solution allows me to open Manage | database | relationships and see how the relationships are set up.

              You have one table with three occurrences of that same table:

              ToDoList::g_currentDate = ToDoList_by_CurrentDate::Due Date

              ToDoList::k_1 ≠ ToDoList_Pending::f_FlagCompleted

              These are called self join relationships, by the way.

              There are a number of ways that you can do this.

              In a find script is probably the simplest to do:

              Enter find mode[] //clear the pause check box
              Set field [ToDoList::Due Date ; ToDoList::g_CurrentDate]
              New Record/Request
              Set FIeld [ToDoList::f_FlagCompleted]
              Omit Record
              Set Error Capture [on]
              perform find[]

              You could also use the second script to find all incomplete tasks, followed by a constrain found set action that omits all records that don't have the due date specified in g_CurrentDate.

              • 4. Re: Combining 2 scripts into one
                rickmarqusee

                I tried the find script.  I got the same results as "Show Today's Items."  It didn't exclude today's completed tasks.

                 

                I wasn't able to figure out what was meant by the second script.

                • 5. Re: Combining 2 scripts into one
                  philmodjunk

                  Just spotted a typo in my last post.

                  Enter find mode[] //clear the pause check box
                  Set field [ToDoList::Due Date ; ToDoList::g_CurrentDate]
                  New Record/Request
                  Set FIeld [ToDoList::f_FlagCompleted ; 1]
                  Omit Record
                  Set Error Capture [on]
                  perform find[]

                  left out that ; 1 in the second set field step. Embarassed

                  • 6. Re: Combining 2 scripts into one
                    rickmarqusee

                    cool; that did it.

                     

                    much thanks.  I do appreciate your help.