Python Dictionary that can ignore a field

03-21-2017 04:09 PM
New Contributor III


I have adapted a python dictionary from here to join and calculate a field between a feature class and a lookup table while concatenating on the fly.

Is it possible to ignore a field while concatenating and still calculate a value in?

ie. I am concatenating on the fly using a python dictionary using field [Main_Type], [Material], and [Diameter] in my feature class. In my lookup table that becomes a python dictionary I have the same fields but for each Main_Type and Diameter I leave a blank Diameter field with a lookup cost. I want to concatenate/field calculate the cost from the lookup to the feature class and if the Diameter field does not match, then match based on the Main_Type and Material only.

Any help would be appreciated!

Tags (2)
0 Kudos
3 Replies
MVP Frequent Contributor

"Is it possible to ignore a field while concatenating and still calculate a value in?"

Well in python code, just about anything is possible.

But a look at what you have so far, Arc version etc might help someone give more specific advice.

New Contributor III

Sorry, I am using ArcMap 10.3.1.
I have used a double concatenation string in python to catch 99.9% of my lookups, first using two fields against the lookup (for a general lookup), and then a 3 field lookup for specific lookups in the table.

In the lookup table I have a full look up reference (Utility-Type-Material-Diameter --> Water-Pressure Main-PVC-100) but I also have partial references (Water-Pressure Main-PVC-), so using a python dictionary to input a unit rate I only use the Type and Material, then I use Type, Material, and Diameter. After the rates are in I multiply against the length. Its not a perfect system but it allows for any diameters not found in the lookup table per type and material to be given a rate.

The attached text file using python 

0 Kudos
MVP Regular Contributor

Can you please post your Python code in the code syntax highlighter.

0 Kudos