Retrieve Coded Domain Values from Query

11303
18
08-13-2010 01:13 PM
DonCaviness
New Contributor III
I am running a query on a dataset and the data that is being returned has coded domain values in the database.  How do I get the name returned instead of the value?  In other words I am getting the value of '1' but I would like returned 'School'.  I can see in the REST directory that the all the info is there, I am just not sure how to display 'School' instead of '1'.  Any examples or help would be greatly appreciated.
Tags (2)
0 Kudos
18 Replies
RobertScheitlin__GISP
MVP Emeritus
Robert,

   Just remove the

currentState="test"


from the application tag.
0 Kudos
BrendanLee
New Contributor II
Is there a way to do this with ArcGIS API for Flex 1.3?
I can't upgrade to 2.3 yet...so I'm hoping I can get to the domain values and not have to do a lot of coding to assign the values.

Thanks!
0 Kudos
GreigOldford
New Contributor
Really useful snippet of code, thanks! 

I'd like to apply this to a SearchWidget query result. I'm not sure where to begin - where would I insert the modified snippet of code?  So far I've only been working with the SearchWidget XML files. 

Cheers,
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Greig,

   The searchWidget has had this since Flex Viewer 2.2.
0 Kudos
DanielEisenberg
New Contributor II
"The searchWidget has had this since Flex Viewer 2.2."

We are using the eSearch Widget and want the domain values instead of the code returned.

I see the feature works in the widget results, floatDG, and the resulting info popup on rollover.

But it doesn't work on the fixedDG, which is what we want. (See attached image) I'm thinking it is probably an easy fix, but haven't found it yet. Ideas?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   I do see an issue in the code and will get it fixed in the next release. In the mean time a work around is to run the query a second time and the code values appear correctly.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   Version 2.4.0.12 is now released and fixes this issue.
0 Kudos
Rocky_
by
Occasional Contributor

Hi Robert, i saw lots of discussions on coded Domain values when doing Query tasks. But not a single is useful for me yet. I am having same question as you explain here. Can you please help me with the same for 4.9 API.

I am having 2 attributes with coded values..I want to add a drop down menu to selecting values for that specific attribute. So user can select specific value of that attribute and perform query task.

Right now am using below function.. 

Thank you.

let Status = new Query({
   returnGeometry: false,
   where: '1=1',
   returnDistinctValues: true,
   outFields: ['STATUS']
});
qTask1.execute(Status).then(function(results) {
      results.features.map(function(feat) {
      let opt5 = document.createElement('option');
      opt5.value = feat.attributes.STATUS;
      opt5.innerHTML = feat.attributes.STATUS;
      stadd.appendChild(opt5);
});
view.graphic.add(selectedGraphics);
});

let qSubtype = new Query({
   returnGeometry: false,
   where: '1=1',
   returnDistinctValues: true,
   outFields: ['SUBTYPE']
});
qTask72.execute(qSubtype).then(function(results) {
      results.features.map(function(feat) {
      let opt3 = document.createElement('option');
      opt3.value = feat.attributes.SUBTYPE;
      opt3.innerHTML = feat.attributes.SUBTYPE;
      subdd.appendChild(opt3);
});
view.graphic.add(selectedGraphics);
});

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

RAJ,

   You need to start a new thread in the JS API space as this space is about an old technology called Flex.