I have a tool with a ValueTable consisting of two columns - text (GPString) and layer (GPFeatureLayer). When I fill the parameter with desired values (field names in the first column, some feature layers in the second column, I can run the tool.
Problem is that not every row is filled with a layer, so some rows have the field names only. The second row of the value table then returns:
- a geoprocessing Layer object if it has been filled with a feature layer or
- a geoprocessing value object if it has not been filled with a feature layer.
It looks like this:
I have a problem accessing the values row by row - I want to process all the rows with filled feature layer:
... def getParameterInfo(self): """Define parameter definitions""" param0 = parameter("lokality", "Lokality", "GPFeatureLayer") param1 = parameter("value_table", "Atributy a FeatureLayery", "GPValueTable", "Optional") param1.columns = [["String", "Atribut"], ["GPFeatureLayer", "Limity"]] def execute(self, parameters, messages): """The source code of the tool.""" lokality = parameters.valueAsText valuetable = parameters.value for v in valuetable: # if v has been filled, it is a geoprocessing layer object. I can check e.g. its name and continue if v.name: do something # if v has not been filled, it is an empty(?) geoprocessing value object, I don´t know how to handle this empty row
How can I check if a layer has been filled and process rows with filled layers only?