I am using ArcGIS 10.2 Model Builder with the Field Values iterator to select unique field values. I then want to forward these values to the Add Field tool, to create a new field for each unique value.
The problem I have is that the iterator's output value appears to have a temporary starter value of "1" by default, which is then replaced by the actual values once the model runs. However, the issue is that the Add Field tool throws an error before the model even starts, because it cannot use numbers as inputs for field names, so it remains out of action once the "real" values become available.
Ideas for how to flush-out or replace this starting value of "1" would be much appreciated.
FYI - the Iterate Field Values tool is correctly set to "String" data type, yet the temporary starter / filler value remains "1".
I've attached a picture of my model and submodel. Any help would be appreciated.
UPDATE: I was unable to get it working in Model Builder, it is presumably a bug. But I was successful in getting it working via a python script along the lines of the answer listed below.