Defining coded value domains

249
4
Jump to solution
08-22-2023 08:34 AM
bsklaohfl
New Contributor III

Hi, 

I have a coded value domain for a field called asset owner, from -1 to -7. Which function would I use to define each value with a string. Example, -1 = Private, -2 = Other, etc etc.


Thank you.

0 Kudos
2 Solutions

Accepted Solutions
Ian_Muehlenhaus
Esri Contributor
Hi bsklaohfl,

I believe you would:

* Show Table
* Add Field
* Then type:

IF(codedFieldName=-1,”Private”,IF(codedFieldName=-2,”Other”,IF(codedFieldName=-3,”Other2”,IF(codedFieldName=-4,”Other3”,IF(codedFieldName=-5,”Other4”,IF(codedFieldName=-5, “Other5”, IF(codedFieldName=-6,”Other6”, IF(codedFieldName=-7,”LastOther”, “Unknown”))))))))



I haven’t checked this, so apologies for a typo. But basically, you can write an IF function using the above syntax. It will go through and anything with a -x number will be given the corresponding text (e.g., “Other5”). If one of the values isn’t listed, it will be given “Unknown” – see the last value and change it to whatever you want.

Better yet? I recommend downloading ArcGIS Insights Desktop. Open your data in the Data Engineering tool. Go to the field and select CHANGE DATA TYPE to String. Then do a FIND AND REPLACE on the field and replace every value with your preferred text. Very convenient in Data Engineering in Desktop version.

I hope this helps! Sorry if I misinterpreted your question. And thank you for using ArcGIS Insights!

Ian
-------------------
Ian Muehlenhaus
Location Analytics

View solution in original post

0 Kudos
bsklaohfl
New Contributor III

 

 

Hi @Ian_Muehlenhaus ,

That worked! Thank you. I knew there had to be a way, thank you so much for your helpful response. I also installed ArcGIS Insights for Desktop - I didn't know it existed...ha! In case anyone is looking for something similar, here is the formula I used to calculate my asset ownership field:

 

IF(OWNEDBY=-1,"Private",IF(OWNEDBY=-2,"Other",IF(OWNEDBY=1,"County",IF(OWNEDBY=-3,"HOA",IF(OWNEDBY=-4,"State",IF(OWNEDBY=-5,"Parks and Rec Dept",IF(OWNEDBY=-6,"City of St. Augustine",IF(OWNEDBY=-7,"Contractor"))))))))

 

 

View solution in original post

4 Replies
Ian_Muehlenhaus
Esri Contributor
Hi bsklaohfl,

I believe you would:

* Show Table
* Add Field
* Then type:

IF(codedFieldName=-1,”Private”,IF(codedFieldName=-2,”Other”,IF(codedFieldName=-3,”Other2”,IF(codedFieldName=-4,”Other3”,IF(codedFieldName=-5,”Other4”,IF(codedFieldName=-5, “Other5”, IF(codedFieldName=-6,”Other6”, IF(codedFieldName=-7,”LastOther”, “Unknown”))))))))



I haven’t checked this, so apologies for a typo. But basically, you can write an IF function using the above syntax. It will go through and anything with a -x number will be given the corresponding text (e.g., “Other5”). If one of the values isn’t listed, it will be given “Unknown” – see the last value and change it to whatever you want.

Better yet? I recommend downloading ArcGIS Insights Desktop. Open your data in the Data Engineering tool. Go to the field and select CHANGE DATA TYPE to String. Then do a FIND AND REPLACE on the field and replace every value with your preferred text. Very convenient in Data Engineering in Desktop version.

I hope this helps! Sorry if I misinterpreted your question. And thank you for using ArcGIS Insights!

Ian
-------------------
Ian Muehlenhaus
Location Analytics
0 Kudos
bsklaohfl
New Contributor III

 

 

Hi @Ian_Muehlenhaus ,

That worked! Thank you. I knew there had to be a way, thank you so much for your helpful response. I also installed ArcGIS Insights for Desktop - I didn't know it existed...ha! In case anyone is looking for something similar, here is the formula I used to calculate my asset ownership field:

 

IF(OWNEDBY=-1,"Private",IF(OWNEDBY=-2,"Other",IF(OWNEDBY=1,"County",IF(OWNEDBY=-3,"HOA",IF(OWNEDBY=-4,"State",IF(OWNEDBY=-5,"Parks and Rec Dept",IF(OWNEDBY=-6,"City of St. Augustine",IF(OWNEDBY=-7,"Contractor"))))))))

 

 

Ian_Muehlenhaus
Esri Contributor

So happy it helped, @bsklaohfl! Woohoo!!!

Thanks for sharing the code you used.

Yes, the IF statement comes in very, very handy! 🙂  Once you use it once, there's no going back! 😉

Thank you for using ArcGIS Insights! All the best on your project!

Ian

-------------------
Ian Muehlenhaus
Location Analytics
0 Kudos
LauraBecht
Occasional Contributor
Hi, you basically create a new field and calculate an if statement, so IF(asset owner = -1, 'Private', IF(asset owner = -2,'Other',...,default). Should get your coded values.

Regards,
Laura Becht
0 Kudos