Select to view content in your preferred language

Customize Date Picker for Python Toolbox Parameters

4038
4
11-19-2012 11:24 AM
MichaelMarkieta
Occasional Contributor
Hi all,

I have a Python Toolbox that converts a file geodatabase table to a format useful in external analysis. However, I would like to be able to export a subset of data by selecting a specific date on a calendar.

What I have now is a date selection calendar that I can use to select the appropriate date. What I would like is for the calendar to only make available to me the dates that are available in the param0 "DATE" column. See example code and screenshot below.

def getParameterInfo(self):
    param0 = arcpy.Parameter(displayName="Input Table",
                             name="in_table",
                             datatype="Table",
                             parameterType="Required",
                             direction="Input")

    param1 = arcpy.Parameter(displayName="Input Date",
                             name="in_date",
                             datatype="Date",
                             parameterType="Required",
                             direction="Input")


As you can see, there is only data available for 1/3/2012. I would like all calendar dates to be suppressed except for the those dates in the param0 "DATE" column.

[ATTACH=CONFIG]19403[/ATTACH]
Tags (2)
0 Kudos
4 Replies
MattSayler__Work_
Deactivated User
I like the idea. Will be interesting to see if they have the date picker exposed (haven't seen anything in documentation that indicates it is, but who knows?).
0 Kudos
curtvprice
MVP Esteemed Contributor
I have a Python Toolbox that converts a file geodatabase table to a format useful in external analysis. However, I would like to be able to export a subset of data by selecting a specific date on a calendar.


Seems to me the best approach would  be to treat the date as a string and in the validation code read the date values out of the file, unique and sort them, and populate a pick list (filter property) of strings for the user to choose from. This would probably be easier to navigate than the calendar widget anyway.
0 Kudos
ThomMackey
Regular Contributor

What I have now is a date selection calendar that I can use to select the appropriate date.


Do you have this operating now? That would be really useful for a tool I'm working on, too. Would you mind sharing how you did it?

Edit: Hahaha, I never even noticed there was a "Date" parameter type that provided a date picker! That's super useful! Just when you start to think you've got this ArcMap thing under control...
0 Kudos
DPolis
by
Deactivated User
Is there a way to limit the Date date type to Date only ie limit the Calendar date format radial buttons?