3 Replies Latest reply on Nov 27, 2012 10:03 AM by philmodjunk

    Need find script for variable dates

    brianpatterson

      Title

      Need find script for variable dates

      Post

           For my table EVENTS I need a script to finds events from 7 days go into the future.

           I would prefer to return the results in a Value List, since there will nver bemore than to or three future events on the calendar. However, my client would accept a separate find layout based on the EVENTS table if necessary.

            

        • 1. Re: Need find script for variable dates
          philmodjunk

                "7 days go into the future"

               Do you mean dates from today to 7 days into the future?

               To perform a find for that:

               Enter Find mode[]
               Set field [YourTable::YourDateField ; Get ( CurrentDate ) & "..." & Get ( CurrentDate ) + 7 ]
               Set Error Capture [on]
               Perform Find[]

               To set up a conditional value list based on such a date range, you need a relationship that matches on a date range. One way to do that is this relationship:

               MainTable::gDate1 <= Events::EventDate AND
               MainTable::gDate2 >= Events::EventDate

               gDate1 and gDate2 should be date fields with global storage enabled.

          • 2. Re: Need find script for variable dates
            brianpatterson

                 I have refined my thinking, and I really have two separate questions.

            First Question

                 My client is a small promoter of classical choral concerts. They work on two concerts at a time, the last one and the next one. These two should be in the pick list. A button to expand the pick list to include all concerts might be needed in the future. When the layout loads, both should be available but by default the last concert they workied on shuld be chosen.

            Second Question

                 You have suggersted using a global value to pass a value. My background makes global variables an anathema; It seems like it is a standard in FM and I need to get used to it.

                 The process requires them to go from the contact finder layout to the reservation layout passing the contact ID. The reservation layout represents a many to many join of Contact to Concerts. I need to dispay the contact name using the contact ID.  If the reservation exists (found set count = 1) they can edit it. If the reservation does not exist ( found set count = 0) they will create it.

                  

                  

            • 3. Re: Need find script for variable dates
              philmodjunk

                   First Question:

                   There is not enough detail in your description to enable me to suggest an answer. Do you have a table where each concert is a separate record? How, just by examining the data in these records can you tell which one is the "last one" and which is the "next one"? Is there a concert date field?

                   Second Question:

                   Once again there is not enough info. You need to describe the tables and relationships in more detail.