2

Is there a way to add GUIDs from a feature class to a table based on specific attributes? I have a large maintenance record table that is tied to specific points through the GUID of that point. I have added new records but they are not tied to a point yet. Instead of going through and copy/pasting each pole GUID to the appropriate maintenance record manually, I was hoping to use model builder or python to populate the fields in the table automatically. The data that overlaps between the two is the name of the line and the pole number.

I think this is a relationship (many to many), but both the line name and the pole number need to match. I'm also new to using model builder and python.

  • 1
    Could you perhaps graphically illustrate what it is you want to do? You have a GUIDs for a given pole, and a maintenance table with many GUIDs for the one pole, correct? This would best be illustrated by a relate or query table. – GISKid May 13 '16 at 19:04
2

ModelBuilder does not provide a solution where you can create an editable join based on multiple fields. Your question is virtually the same as Auto populating field in attribute table, using several fields of record information from another table? and the answers are the same. You must either concatenate the fields into a single new field, run my Multi-field Key to Single-field Key tool to create a new numeric field that represents the multi-field key or use the Make Query Table tool. I do not consider the Make Query Table option workable, since it cannot be edited, it drops unmatched records, and it requires that you constantly recreate your entire feature class each time to update it.

A Python script could do it using a cursor and dictionary. See my Blog on Turbo Charging Data Manipulation with Python Cursors and Dictionaries. In particular look at the example of Creating a Multi-Field Python Dictionary Key to Replace a Concatenated Join Field. Once a working script has been writen, this is actually the fastest of the methods and since once it completed you would have a single field key through your GUID, it is probably the best for your particular data. The concatenated field or single field key would be redundant once your GUID was transferred.

The python script underlying the Multi-field key to Single field key tool has a more sophisticated method of doing the multi-field matching, since it preserves the sort order native to each field type rather than using the sorting that occurs when values are converted to strings. So if you want a single key that sorts the same way that the separate fields would sort, this tool is the best.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.