Modelbuilder - Field Exists, Data Exists in ArcMap

1584
6
Jump to solution
06-24-2021 05:17 AM
Labels (1)
FynnScharpen
Occasional Contributor

Hello there,

lately, I'm working a lot with Modelbuilder in ArcGISPro and enjoying the upgrade. 

I used models in Pro to check data and fields of attribute tables. Today I tried to develop such a model in ArcMap as well but couldn't find a similar function to "field exists" and "data exists" which I used in Pro. Are there similar functions I don't know of? 🙂 I'm not very experienced in Python so programming it on my own would be hard. 

If you have any tips pls let me know. I would be grateful!

Kind regards from Germany!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ABishop
MVP Regular Contributor

Hello again @FynnScharpen 

In ArcMap, you can add a tool to your model called table to table, and add an expression with definition query to determine if the output field exists or contains data.  If the output contains data, you know if there are null values (you could reverse this to include the values that are not null as well). So, for your Name, Street, City, attributes you could write a definition query that looks like the query below (I have also included a screen shot of sample data used from our parcel dataset with PARCEL, KIND, and ANGLE fields to show you what the expression builder looks like - mine is Pro but should be the same in ArcMap):

NAME IS NOT NULL And STREET IS NOT NULL And CITY IS NOT NULL

AmandaBishopMCPAFL_0-1626697490683.png

 

Amanda Bishop, GISP

View solution in original post

6 Replies
ABishop
MVP Regular Contributor

Hello @FynnScharpen 

To get a better understanding, what are you using the "field exists" and "data exists" functions to check for?  There may be other ways to write this into a model.

Amanda Bishop, GISP
FynnScharpen
Occasional Contributor

Before a friend gives me an attribute table that has to have for example name, street, and city he shall run the model that's checking if the 3 columns exist and if they include information. 

The output should be a list that says:

Name: True

Street: False 

City: True

So I don't have to put in the work and check every attribute table each time. instead, I can just run the model and ask for an update if he forgot smth. In ArcGISPro it already exists as logic functions but Map doesn't have such a thing

0 Kudos
ABishop
MVP Regular Contributor

Hello again @FynnScharpen 

In ArcMap, you can add a tool to your model called table to table, and add an expression with definition query to determine if the output field exists or contains data.  If the output contains data, you know if there are null values (you could reverse this to include the values that are not null as well). So, for your Name, Street, City, attributes you could write a definition query that looks like the query below (I have also included a screen shot of sample data used from our parcel dataset with PARCEL, KIND, and ANGLE fields to show you what the expression builder looks like - mine is Pro but should be the same in ArcMap):

NAME IS NOT NULL And STREET IS NOT NULL And CITY IS NOT NULL

AmandaBishopMCPAFL_0-1626697490683.png

 

Amanda Bishop, GISP
BRHolmes
New Contributor II

I have the same problem but I need the output to be a geodatabase feature class.  As part of a model, I need to check to see if the fc has a GIS_Acres field.  I also am not very experienced with python, but I have some code that I can use as a script in the model to check for the field, but I'm struggling with creating the output.  Any help would be appreciated.

0 Kudos
FynnScharpen
Occasional Contributor

Thanks for your help! 🙂

ABishop
MVP Regular Contributor

You're welcome!  I am glad this worked for you. 😀

Amanda Bishop, GISP
0 Kudos