Select to view content in your preferred language

ArcGIS Pro 3.1.2 - How to use Field output from Iterate Fields as an inline variable?

388
2
11-01-2023 03:16 AM
VincentLaunstorfer
Regular Contributor

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.

ModelBuilder_Inline_String_with_IterateFields.png

0 Kudos
2 Replies
Marisa_Kordecki
New Contributor III

@VincentLaunstorfer ,were you able to figure this out? I am having the same issue.

0 Kudos
VincentLaunstorfer
Regular Contributor

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!

Iterate_Fields.png

0 Kudos