I'm trying to take a field called Code List which contains the abbreviations for mineral deposits (ex: AU CU PB) either convert this to a field which contains multiple values (one for each mineral) or create new fields for each mineral but am not sure how to go about this. Any advice would be greatly appreciated.
Solved! Go to Solution.
Imagine this is your current data structure:
ID| StringField | CodeList
1 | abc | AU CU PB
2 | def | AU
To get this structure:
ID| StringField | CodeList
1 | abc | AU
2 | abc | CU
3 | abc | PB
4 | def | AU
Use the script I provided in this question.
To get this structure:
ID| StringField | AU | CU | PB
1 | abc | 1 | 1 | 1
2 | def | 1 | 0 | 0
var codelist = $feature.CodeList
if(IsEmpty(codelist)) { return 0 }
if(Includes(Split(codelist, " "), "AU")) { return 1 } // change mineral here!
return 0
Not sure exactly what your data structure is, perhaps a small example would help respondents, but possibly Pivot Table (Data Management)—ArcGIS Pro | Documentation
Imagine this is your current data structure:
ID| StringField | CodeList
1 | abc | AU CU PB
2 | def | AU
To get this structure:
ID| StringField | CodeList
1 | abc | AU
2 | abc | CU
3 | abc | PB
4 | def | AU
Use the script I provided in this question.
To get this structure:
ID| StringField | AU | CU | PB
1 | abc | 1 | 1 | 1
2 | def | 1 | 0 | 0
var codelist = $feature.CodeList
if(IsEmpty(codelist)) { return 0 }
if(Includes(Split(codelist, " "), "AU")) { return 1 } // change mineral here!
return 0