AnsweredAssumed Answered

Using the .split() to grab attribute from KMZ

Question asked by twoodfield_DawoodGIS on Sep 24, 2020
Latest reply on Oct 1, 2020 by agelfert

Hi everyone,


I am trying to use the .split() function on a string and keep gettings errors. The field is the popup information from a converted KMZ and is called PopupInfo. The code I am trying to use is:


but am getting Error 000539 and is saying "IndexError: list index out of range". The calculation will run fine if 14 is swapped out for 0 or -1 to get the first or last section. I am counting 27 sections if it is being broken at each "<br>". I've tried finding and replacing all of the <br>'s with a dash or underscore but the calculation still fails with anything other than 0 or -1. The text string that I am trying to pull from looks something like this: 

US20 EB    <br>       <br>   FID   57    <br>   RampDate   9/30/2013    <br>   RouteId   161    <br>   RouteName   US20 EB    <br>   TownId   314    <br>   TownName   Watertown    <br>   IsMissingR   False    <br>   IsMissingS   False    <br>   IsMissingC   True    <br>   InspNotes       <br>   DistrictId   6    <br>   LegacyID   335    <br>   status   6    <br>   StatusText   Deficient    <br>   DstrctRank   669    <br>   deficient   -1    <br>   GlobalID   {C4BBAA58-9DFE-4953-AC74-FF3448002388}    <br>   created_us       <br>   created_da       <br>   last_edite   DAVID.DINOCCO    <br>   last_edi_1   10/17/2017    <br>   ReInspectn   0    <br>   AssetID       <br>   ProgNotes       <br>   Rank   669

I would be trying to field calc a different field with the LegacyID from this PopupInfo. Is there a problem with this string that is causing the index errors? The lengths at both ends are never the same so I can't trim off the ends.


Thanks for the help!