Ability to Apply a Field Mapping Depending on a Value Selected

434
1
05-14-2020 09:55 AM
NicoKroes2
New Contributor III

Hello All:

I have a quick question. Do any of you know if it is possible to apply a certain field mapping depending on the result of if then logic?

Here is our use case. What we are attempting to accomplish is to build a Modelbuilder tool which appends street centerlines from neighboring jurisdictions to feature classes that already exist in our enterprise geodatabase. Each new centerline feature class that we receive from a neighboring jurisdiction has different fields while the neighboring jurisdictions in our enterprise geodatabase all have the same fields. I am not sure if this is possible, however, what we are attempting to do is to have a certain field mapping be applied during the append depending on which municipality's feature class is the input layer in the append tool. Is this possible to accomplish?

Thanks and please let me know if I can provide any information that might help.

Nico

0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor

I have always found field mapping a very powerful component of geoprocessing tools but a real nightmare to implement. Also I find when in model builder tools do their validations and unhinge any field mapping/ joins that you have loving crafted. I feel you end up with a chicken and egg situation sometimes.

So the answer is simple, move your logic out of modelbuilder and into a python script. You will have considerably more control over your if/then logic and construction of field maps and when to apply them. If written as a script you could wire it up to a tool interface and then drop that into a model if you so desire.

That's what I would do...

0 Kudos