IdentifyTask get Coded Domain Values NOT Description

5376
7
Jump to solution
07-14-2015 09:11 AM
Kathleen_Crombez
Occasional Contributor III

When I use the Identify Task on a layer with a coded domain, it returns the coded domain description and not the value.

How can I receive the coded value?

For example.

In our zoning layer... if zoning of SF1 is identified, the callback returns Single Family District... but I want the actual code SF1.

I have unchecked all the following boxes in the map document that specify to display the description.

Layer Properties Display Expression

Layer Properties Label Expression

Layer Properties HTML Popup

Layer Attribute Table Appearance

But the JavaScript API is still returning the description. Similarly, when I identify in the map document, I receive Single Family District and not SF1.

Am I missing a setting someplace? or is there a setting in the identify parameters that I am overlooking?

0 Kudos
1 Solution

Accepted Solutions
Kathleen_Crombez
Occasional Contributor III

It has been a couple years since I created this post.

But I wanted to provide an update for other people who may still run across this looking for a solution.

Included at version 3.22 there is now an Identify Parameter that you can set to get the domain value.

identifyParams.returnUnformattedValues = false;

View solution in original post

0 Kudos
7 Replies
Kathleen_Crombez
Occasional Contributor III

I also tried ArcMap Options Tables. Still no luck getting the coded value.

0 Kudos
Kathleen_Crombez
Occasional Contributor III

I was never able to figure out how to receive the coded domain value using the Identify Task.

But I found a little work around (hack) to get to the information.

I run the Identify Task on the item that gets selected.

I grab the OBJECTID returned from that task and then run a Query Task on the OBJECTID.

The Query Task will return the coded domain value instead of the description.

identifyTask.execute(identifyParams, identifyResults);

function identifyResults(results) {

     var ObjectID = idResults[0].feature.attributes.OBJECTID;

     query.where = "OBJECTID = " + ObjectID;

     query.returnGeometry = true;

     queryTask.execute(query, queryResults);

}

It's not the best solution, but it works.

0 Kudos
KristianEkenes
Esri Regular Contributor

How are you able to get the coded value from the queryResults? Is it the same field you tried referencing in the identifyResults?

0 Kudos
Kathleen_Crombez
Occasional Contributor III

Kristian Ekenes​,

Yes. I am referencing the same field in the Query Task that I tried to reference in the Identify Task.

The syntax is a little different though.

In the Identify Task...

value= results[0].feature.attributes.FieldName;

In the Query Task...

value= results.features[0].attributes.FieldName;

I don't know if it makes a difference or not... but I am still referencing the JS API version 3.6. I hope the functionality hasn't changed in the latest release. (which is currently at 3.14).

Another thing I am going to note:

There are several places in the map document where I have selected to NOT display the coded value description.

I have not done enough testing to know if any of these settings make a difference or not.

In the Layer Properties:

Display > Expression > Uncheck "Display coded value description"

Labels > Expression > Uncheck "Display coded value description"

HTML Popup > Uncheck "Display coded value descriptions in all HTML content"

In the Attribute Table:

Table Options > Appearance > Uncheck "Display coded value domain and subtype descriptions"

In ArcMap Options:

Customize > ArcMap Options > Uncheck "Display coded value domain and subtype descriptions"

0 Kudos
ChrisSergent
Regular Contributor III

Kathleen,

Check out my at at: csergent45/streetSigns · GitHub

I dropdown list boxes in that application with domain values.

0 Kudos
Kathleen_Crombez
Occasional Contributor III

Thanks Chris Sergent​,

It looks like you are using the Query Task in that application.

Which is exactly what I used as the work around.

The Identify Task does not seem to honor the coded domain values. Only the coded domain descriptions.

Kathleen_Crombez
Occasional Contributor III

It has been a couple years since I created this post.

But I wanted to provide an update for other people who may still run across this looking for a solution.

Included at version 3.22 there is now an Identify Parameter that you can set to get the domain value.

identifyParams.returnUnformattedValues = false;

0 Kudos