Select to view content in your preferred language

Splitting data in an attribute table into multiple fields

7545
12
Jump to solution
06-08-2021 01:37 AM
SimonCrutchley
Frequent Contributor

I have data in a concatenated list, created so that it is searchable in a single attribute, but I now discover that I need to make hyperlinks to the various entries 

The easiest way to do this seems to be to split them into separate entries and then do a link to each unique entry, as there are far too many different combinations. 

I currently have the concatenated fields separated by / e.g. the field currently called 'TYPE' has entries such as 'ENCLOSURE/FIELD/FIELD SYSTEM/SETTLEMENT' and I would like this to become a number of separate new fields TYPE1 = 'ENCLOSURE', TYPE2 = 'FIELD', TYPE3 = 'FIELD SYSTEM' etc

I attach a sample of a file where I did the split manually, to see if the process would produce the data in a form that I could then use in Portal, in a pop-up.

Hope you can help

Thanks

I suspect this may be similar to the solution given to another post I had Splitting data in an attribute table 

 

0 Kudos
12 Replies
SimonCrutchley
Frequent Contributor

I've just realised that some entries don't have multiples, so there is no '\'. Is this the problem? If so, do I need to filter on multiples, or is there a way to do this in the script?

Thanks

0 Kudos
JayantaPoddar
MVP Alum

You can use this modified script for others (except Type1). The split function uses the same logic as before, i.e. [1] for Type2 and [2] for Type3.

 

 

If (Find('\\',$feature.NARROWTYPE, 0) > 0)
{
Split($feature.NARROWTYPE,'\\')[1]
}
else
{
" "
}

 

 

 

JayantaPoddar_0-1623158635390.png

 

 



Think Location
0 Kudos
SimonCrutchley
Frequent Contributor

Thanks for that, but I'm now very puzzled, as checking 'Verify' it seems to be valid

SimonCrutchley_0-1623160280660.png

but on actually running it, I get an error?

SimonCrutchley_1-1623160332453.png

How is that even possible?

Sorry

0 Kudos