Select to view content in your preferred language

Extract Attributes from a Field

695
5
08-09-2022 01:07 PM
Labels (2)
aam
by
Frequent Contributor

Please see the attached image. Each of the underlined section of the string needs to go to its respective field. 

Currently all the information is within one field. What's the best way to extract information I need and place it in their respective fields.?

Capture.JPG

Tags (1)
0 Kudos
5 Replies
FrancisClergue
Emerging Contributor

I don't see your attached image...

0 Kudos
aam
by
Frequent Contributor

Thank you for pointing that out. Post has been updated with image.

0 Kudos
FrancisClergue
Emerging Contributor

I'd be inclined to export the attribute table to a .dbf and try to separate the values in MS Access.  Doing a little testing, you'd:

  • import the .dbf in Access
  • copy the entire field of values you want to separate from Access and paste into a .txt. file
  • find and replace <br> with a comma (could also do a series of finds and replaces to replace each <br> and the following field name and unnecessary spaces with a comma)
  • import back into Access as a comma delimited text file, which will put each value into its own field
  • use the RIGHT() function to to get rid of the field name (like From:) with an update query if you didn't find and replace them out above (could just do this in ArcMap with the same field calculator function)
  • add all the appropriate fields to the attribute table in ArcMap
  • export the Access table you made to a .dbf and re-import to ArcMap
  • join the table with OBJECTID
  • use field calculator to copy over the separated values from the joined table to each corresponding field you added above to the master attribute table
  • remove the join

Something like that...clunky, but if it's a one-time job it shouldn't take long.

0 Kudos
RhettZufelt
MVP Notable Contributor

Similar to @FrancisClergue , but could open the txt file in Excel, replace the <br> with a colon, then text to columns using the colon as the delimiter.  Then just delete the columns you don't want.

R

0 Kudos
Kara_Shindle
Frequent Contributor

I could also see you doing a lot of this with Python and string slicing or even using Pandas dataframes.  Lots of methods depending on your comfort zone.

I also think this could probably be accomplished with a combination of Arcade and Field Calculator.

0 Kudos