Append not recognizing all fields in Input dataset for Field Mapping in MB

761
1
10-23-2018 10:36 AM
by Anonymous User
Not applicable

I’m having a doozy of a time figuring out a problem I am having with the model below. What the tool does is takes a layer of re-routes (lines) and makes survey corridors, centerlines, and mileposts based on the route name. The centerline and buffer part work perfectly. And the milepost section works just fine until I get to the final append shown in red below (apologies for the poor image quality). Follow me as I try to explain what is going on (or not going on, in this case).

 

When I open the append tool (prior to running the tool) I see MRL_RID and MRL_MEAS are not being mapped properly. Okay, I’ll add input…

 

Hmmm, it looks like I can only add layers that were joined in the step before the append

 

But when I look at the attribute table for the input feature I see MRL_RID and MRL_MEAS front and center.

 

So I run the tool anyway which results in the table below. As you can see the MRL_RID and MRL_MEAS fields are blank (not good).

 

What is really odd to me is once I go back into the tool after it has been run and open the append tool I find MRL_RID and MRL_MEAS are properly mapped.

 

 

However, if I validate the model again or change any of the input features/parameters (which will be necessary) the properly mapped fields go away and I'm left with an append window like that shown in image 2. When I run the append tool by itself (not in the model) with the same Input and Target Datasets, everything matches just fine. 

I’ve tried adding ‘Make Feature Layer’ in multiple areas (including on both features going into the ‘Append’ tool - this has worked on countless occasions in the past), copying the input dataset before it's added into the Append tool, and isolating this part of the tool to try and work it out but I'm running into the exact same issues so its placement in the model isn't the problem. 

Any ideas and suggestions are welcome at this point. 

0 Kudos
1 Reply
curtvprice
MVP Esteemed Contributor

The only way I have been able to get this to work is to construct a field map explicitly using a Calculate Value python function. The field map construction only happens in edit mode and does not run when the model is run, so if you change the model input, the field map is not updated. Using Calculate Value constructs the field map at runtime which avoids this limitation. Complex, I know, but it does work.

“Feature class to feature class” problem in the model builder

0 Kudos