Select to view content in your preferred language

Accessing Subtype Domain Details

732
0
06-26-2013 04:29 AM
ChristinaGnadinger
Emerging Contributor
I have been trying to pull the sybtype domain information over and have run into what feels like a brick wall.

Looking at the snippet below of what is listed in the REST:

"types": [
  {
   "id": 1,
   "name": "Small_Service_Point",
   "domains": {
    "Service.GIS_CONVERSION_DELIVERY_AREA": {"type": "inherited"},
    "Service.SUBTYPE_CODE": {"type": "inherited"},
    "Service.LEAD_DIAMETER": {
     "type": "codedValue",
     "name": "Dom_Small_Service_Diameter",
     "codedValues": [
      {
       "name": "5/8\"",
       "code": 0.625
      },
      {
       "name": "3/4\"",
       "code": 0.75
      },


I need to access the type (i.e. codedValue or inherited), then the codedValues and below.

It seems that I should be able to access this under results.types.domains.type, results.types.domains.codedValues, and so on but it is not working.

Here is a snippet of one of many, many failed tests...

dojo.forEach(res.types, function(resTypes)
        {    
            if (resTypes.id == fieldCodeGood)
            {
                console.log("There is a match to " + resTypes.name);
                domsGood = resTypes.domains;    
                console.log(domsGood);

                for (domFieldNames in domsGood)
                {                
                    console.log(domFieldNames);
                    
                    if (domFieldNames.codedValues)
                    { 
                        console.log("working");
                    }
                    else
                    {
                        console.log("not working");
                    }
                }
            }
            else
            {
                console.log("NO match to " + resTypes.name);
            }
        });                    



The part where it's not working starts at for (domFieldNames in domsGood). I've tried dojo.forEach there and it won't even process. Based on other accesses to the REST it seems I should be able to retrieve these values similar to above but it's not working.

The mapservice is unfortunately not a publicly accessible one and I'm failing to find an example that is at the moment.

Any help that can be given would be greatly appreciated. Thank you in advance!
0 Kudos
0 Replies