Adding Date Picker (Calendar Selector) to Form Date Field


Hi. I’m brand new to Panorama X (moving from FileMaker). So far, so good. Is there a way to add a date picker to a form’s date field(s)? I use these frequently because they make it easier to select the correct date. Obviously, having to manually enter a date value is not a tremendous burden, but pickers are pretty handy. Thanks.


It’s a small project to build one from a calendar matrix.

I just built that one, using the construct menu, and then making some modifications.


Dave, While what you’ve done is pretty easy, the reality is calendar pickers are commonly seen as ‘tools’ that are already pre-built. Your demo does show how easy it can be, but I’m imagining that many newer users might appreciate a few choices to pick from and move on with a choice. It was not a stretch to imagine some amazing piece of work suddenly appearing from one of our over the top talented, too much time of their hands professionals. We have one guy who has 4 letters in his name and it starts with G and he regularly blows us away with his talents for this kind of stuff. :slight_smile:


Put the pressure on me why don’t you.:blush:

Anyway, here is my approach to the problem…

The form requires these objects set as noted:

Three Popup Menu Objects:
    1. The year popup - Data set as theYear and Mode to Formula:
        Procedure Code:
            showvariables theMonth, theDay

    2. The month popup - Data set as theMonth and Mode to Formula:

    3. The day popup - Data set as theDay and Mode to Formula:
            arrayfilter(rep(cr(),monthlength(date(theMonth+" 1, "+theYear))-1),cr(),{pattern(seq(),"##")})

    4. An optional Text Display Object with Mode to Formula:
            theMonth+" "+theDay+", "+theYear

Add this code to your .Initialize procedure to preset the popups:
    makefileglobals theYear=datepattern(today(),"yyyy"),
    showvariables theYear,theMonth,theDay

The year popup will automatically display a list of years 10 years before this year to 10 years past this year. The month popup will display a list of the 12 months of the year while the day popup will display the proper number of days for the chosen month and year.

You can change the range of years by adjusting the year popup formula. The number of years is determined by the value entered into the rep( function (in the above case the 20 will list 21 total years since the repeat is generating the separators which is always 1 less than the total array elements.) The range is determined by the value added or subtracted from the current year value (in the above case it is set to -10 so it starts the year list 10 years previous to the current date).


What happens when the day is set to the 30th, and the user selects February?


The day popup goes blank and the user would have to make a new selection from that popup.


You could also add a trap to the Procedure pane of the month popup object to reset the day to the last day of the selected month if the current day is beyond the range for that month.

if val(theDay)>monthlength(date(theMonth+"/1/"+theYear))
showvariables theDay