4 Replies Latest reply on Apr 10, 2013 12:13 PM by philmodjunk

    Finding a date in a range with the Drop-down calendar

    marksealey

      Title

      Finding a date in a range with the Drop-down calendar

      Post

           How is it possible to Find on a range of dates (e.g. 3/2013...4/2013 for everything this month and last) when I'm using the Drop-down Calendar for Control Style, please?

        • 1. Re: Finding a date in a range with the Drop-down calendar
          philmodjunk

               In a manual search, you can only select the start date from the calendar and then you can enter the ... and second date manually.

               WIth a script, you can select one date in a global field with calendar control, select a second date in a second global field with calendar control and then a script can take the two dates and perform a date range find.

               See this thread for scripted find examples that include a date range search form global date fields: Scripted Find Examples

          • 2. Re: Finding a date in a range with the Drop-down calendar
            marksealey

                 I thought as much! Thanks!

            • 3. Re: Finding a date in a range with the Drop-down calendar
              marksealey

                    

                   I'm trying to work with this script:

                    

              Go To Layout [theonewithdatefield]

              Enter Find Mode []

              Set Field [YourTable::YourField ; Globals::gField]

              Set Error Capture [on]

              Perform Find []

              If [Not Get ( FoundCount ) ]

                  Show Custom Dialog ["No records were found by this search."]

              End IF

                    

                   And will try:

                    

              Set Field [YourTable::YourDateField ; Globals::gDate1 & "..." & Globals::gDate2]

                    

                   next.

                    

                   I'm new to scripting :-)

                    

                   Do I actually need two Date fields?

                    

                   The Table for this project only needs a single date… the one on which a certain document was published, actually.

                    

                   But the Find needs to be able to return all documents filed between two dates.

                    

              • 4. Re: Finding a date in a range with the Drop-down calendar
                philmodjunk

                     To make a date range search, you'd need THREE date fields. One date is the project's "single date". The other two fields make it easy to enter a date range using the drop down calendar feature on each of the two date fields.

                     If you'd rather, you can use a single text field for the date range, but then you don't get to use the calendar feature.