Hi,
In the ModelBuilder below, I iterate through some fields, using Iterate Fields, which I intend to calculate with Calculate Fields.
I use the Field variable as a 'Precondition' in Calculate Fields and the feature class as 'Input Table'. I understand the variable Field is a field type and populate the Field Name in Calculate Fields correctly.
However, I need to 're-use' this variable Field as an inline variable in the Expression enclosed in %. Of course, the syntax is not valid and I cannot figure out how to fix it.
Any help appreciated.
@VincentLaunstorfer ,were you able to figure this out? I am having the same issue.
The Field in ModelBuilder is a Field object and cannot be used 'as is' in an expression using the inline varaible syntax within double-quotes.
To make it works, within ModelBuilder you should use the Calculate Value tool in Utilities and simply use "%Field%" expression, asking to get the Field name as a string. Then, you can use this calculated result as an inline variable.
Here below is the working example. Hope this helps!