Select to view content in your preferred language

Arcmap Fields Value By SQL Query

409
1
11-29-2022 12:02 AM
Labels (1)
EmrahAydemir
New Contributor III

Hello, I have a database with fields. Arcmap is connected to the database and the data in the database is updated with an external API. The database is very large and many data types are related. For example: i have a TREEs_in_USA table. and i have a TREEs_REGIONS table.

TREEs_in_USA table

 

 

 

 

 

{"tree_name":"Tree 1", "region_id":1}

 

 

 

 

 

REGIONS_of_TREEs table

 

 

 

 

 

{"name":"Canada","region_id":1}

 

 

 

 

 

These two tables are related by region_id. When I connect the database to arcmap, the regiond_id of the field named "Tree 1" shows as 1. But I want it to show as "Canada". Is there a way for me to make a SQL query while retrieving the field values? This will be difficult when there are thousands of data.

 

0 Kudos
1 Reply
NinaRihn
Occasional Contributor III

how are you retrieving the values.   As labels?   If it is as labels, you can use an Advanced expression and If/Then query to label the features with ID 1 as Canada, like this   

Function FindLabel ([region_ID])
if [region_ID] = 1 then
FindLabel = "Canada"
elseif [region_ID] = 2 then
FindLabel = "Another region"
if [region_ID] = 3 then
FindLabel = "Yet another region "
else
FindLabel = "No region"
end if
End Function

 

 

0 Kudos