I am trying to take a Value from a ModelBuilder Feature Selection Iterator and pass it to the Calculate Field Python Expression in order to write values to the field of a feature selection in ArcGIS Pro 2.9.0.
My model iterates over the Features in Gridline_Grid by PageName, Value becomes the PageName Value. Then that Selected Feature is used to Select By Location all the NRN_Anno features intersecting it. Then the Selection has it's field GRIDS calculated using a Python expression that is designed to look at GRIDS and if it is 0 recalculate it to %Value% (the value from the iterator) if it is not 0 pass the current GRID value to a concatenate expression with %Value% and recalculate the field to a concatenation of both values.
def reclass(GRIDS):
if (GRIDS == '0'):
return str(%Value%)
else:
return (GRIDS)+', '+ str(%Value%)
The model keeps telling me the Value sotred in %Value% is not defined. This is telling me that python is returning the value from the parameter %Value% but I cannot seem to get it to read it as a string.
What am I doing wrong?