Is it possible to specify max length for arcpy parameter of datatype GPString?

11-19-2019 11:49 PM
New Contributor III

In my Python GP tool getParameterInfo method I want to declare a string parameter like this:

def getParameterInfo(self):
    """Define parameter definitions"""

    paramName = arcpy.Parameter(
        displayName = 'Name',
        name = 'in_name',
        datatype = 'GPString',
        parameterType = 'Required',
        direction = 'Input')
    return [paramName]

Can I specify maximum length of it her? I want 255 as this input will go to the table attribute of varchar(255).

Or I should deal with such validation myself in updateParameters/updateMessages methods?

0 Replies