ToolValidation Code (Python)

2010
2
03-03-2016 01:04 PM
PiusHauenstein
New Contributor II

I'm working on a ToolValidation Code (Python) and want to pass a result (values) from the function "updateParameters" to the function "updateMessages". Does anybody has good example how to do that?

0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor

Just off the top of my head, you could do something like the following using a python toolbox:

class SomeTool(object):
    def __init__(self):
        self.some_variable = None
        #etc...

    def getParameterInfo(self):
        #etc...
        return params

    def updateParameters(self, parameters):
        result = arcpy.ATool_SomeToolbox('somedata')
        self.some_variable = result.GetOutput(0)

    def updateMessages(self, parameters):
        if self.some_variable is not None:
            #Do something
            #etc...
            self.some_variable = None #reset the variable just in case
PiusHauenstein
New Contributor II

Thanks for your idea, but I did not succeed with it. I made now an ugly workaround, but it works for the moment.

0 Kudos