Select to view content in your preferred language

Conditionally Adding a Field, and Running a Tool After

101
4
Jump to solution
3 weeks ago
Labels (2)
CamTurney
Emerging Contributor

I am trying to append features from an input layer to a target layer. Since Schema must match to append, I want to check if the input layer has the matching Field or not. It if does have the specific Field, I want it to run the append tool. However, if it doesn't, I want to add the specific Field, then then run the append tool. I added a snip of my model below. It contains other steps after the append to calculate fields, which is not relevant at this stage.

Thanks!

CamTurney_0-1737651774859.png

 

0 Kudos
1 Solution

Accepted Solutions
DavidSolari
MVP Regular Contributor

Add Field should fail to add a field that already exists and exit with a warning, so you can unconditionally add the field you need and then append, no need for a condition in the model

View solution in original post

0 Kudos
4 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @CamTurney,

You can easily accomplish this by changing the field mapping option to 

RPGIS_0-1737652726310.png

 

DavidSolari
MVP Regular Contributor

This is the best method if the schemas are mostly identical and you want Pro to automatically sort the map out. If you want to set a custom map to ignore certain fields, map fields to a target with different names etc. then there might be issues if the input is missing the field.

0 Kudos
DavidSolari
MVP Regular Contributor

Add Field should fail to add a field that already exists and exit with a warning, so you can unconditionally add the field you need and then append, no need for a condition in the model

0 Kudos
CamTurney
Emerging Contributor

This worked perfectly, thank you!

0 Kudos