PopupTemplate 4.0 content and coded value domain descriptions

2297
7
Jump to solution
08-04-2016 08:50 AM
DavidColey
Frequent Contributor

Hi - just beginning to migrate 3.x apps over to 4.0 and have noticed that, much like the 3.x InfoTemplate, the 4.0 PopupTemplate does not appear to display coded value domain descriptions for fields that have domains assigned.  Is there a work-around or is this functionality not yet available?

Thanks

David

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

It is not yet available 4. But this feature will be available in the future.

View solution in original post

7 Replies
UndralBatsukh
Esri Regular Contributor

It is not yet available 4. But this feature will be available in the future.

DavidColey
Frequent Contributor

thanks

0 Kudos
DavidColey
Frequent Contributor

Hi Undrai  - I notice this functionality is still not available at 4.1, any chance it will be available at 4.2?

Thanks-

David

DavidColey
Frequent Contributor

Hello all, a followup to original question.  We were able to dust off an old function and apply it to 4.x popup content fields:

//set field coded value and field name parameters to store and pass the field name and domains'coded values:

getDomainValue = function (fieldVal, fieldName){
//get the popup's currently selected feature 
 var featureLayer = app.activeView.popup.selectedFeature.layer;
    array.forEach(featureLayer.fields, function (ldf) { //once in the layer pass the fields into an array
       if (ldf.name==fieldName){ //for each field, if the field name property is equavalent to the fieldName param AND if the field is domained, set up a second array to store the coded values:
             if (ldf.domain){
                array.forEach(ldf.domain.codedValues,function(domain){// once in the domain array, get the coded value and swap in the name instead:
                   if (fieldVal==domain.code){
                      fieldVal=domain.name;
                   }
                });
             }
       }
 
    });//finally return the fieldVal
    return fieldVal;
 };
//set this function on your domained fields in the popup template‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

As you can see, I've added some simple comments to desribe how I think it's actaully working.

Hopfully this will help until the 4.x popup template is updated to read in domain names.  

Also, at the moment this only works on the view's popup, not the search widget popup beacuse of how I'm setting up the feature layer var, I've still got to modify for the search's selectedFeature layer.

David

0 Kudos
JimmyBowden
Occasional Contributor II

Am I missing something or is this still no possible in 4.10?

0 Kudos
DavidColey
Frequent Contributor

I have no idea. My last post on this was 2 years ago, and I have not been active in 4.x for several months.  I do seem to recall that I could use an Arcade IIF, When or Coded Values to expression to handle this though

0 Kudos
AlexanderRyzhov2
New Contributor II

Looks like nothing has been chahged in 4.12 version of js api...
It doesn't work with MapImageLayer and works fine with FeatureLayer

0 Kudos