3 Replies Latest reply on Apr 30, 2012 11:13 AM by philmodjunk

    Single Calendar Date Range Picker



      Single Calendar Date Range Picker


       I presently have 2 global fields for a date range (start date and end date). These fields are on the layout and each is set to a date with a date by a drop down calendar. A script triggers OnObjectModify on the end date field drop down calendar. No issues - works fine.

      Is it possible to use a single instance of a drop down calendar that toggles input between the two fields? First click would set the start date field and second click would set the end date field. This would reduce the real-estate required on my layout.


        • 1. Re: Single Calendar Date Range Picker

          By setting the pop up calendar on a third field, a trigger performed script can copy the date picked into the correct global date field or even build a date range expression in a text field.

          • 2. Re: Single Calendar Date Range Picker

             Thanks Phil. I'm guessing the third field must be a global text field?

            My current script using 2-calendars is as follows:

            Enter Find Mode[]

            Set Field [Event::EvenDate;((Event::_gStartDate &"..."&  Event::_gEndDate)

            Perform Find[]

            This is triggered upon OnObjectModify on the EndDate field drop down calendar. How would the script have to change to allow both picks from the same calendar and where would the trigger be placed?


            • 3. Re: Single Calendar Date Range Picker

              Yes a global field, but no not a text field. Make it a field of type date.

              The onObjectSave trigger may be a better option for this field. If your layout permits the user to type in the date instead of selecting a date from the pop up calendar, OnObjectModify will be tripped with each keystroke--not what you want here.

              I'd define two text fields: gSelectADate, gDateRange.

              gDateRange would be a text field.

              Your script might look like this.

              If [IsEmpty ( Event::gDateRange ) // this is date 1 ]
                 Set Field [ Event::gDateRange ; Event::gSelectADate ]
                 SEt Field [Event::gDateRange ; Event::gdateRange & "..." & Event::gSelectADate ]
              End If


              At this point the script can either stop and you use a button to perform a find script or you include the find script after the End IF:

              Enter Find Mode []
              Set Field [event::EventDate ; Event::gDateRange ]
              Set Error capture [on]
              Perform Find []