AnsweredAssumed Answered

Format Popup Content - integer to string

Question asked by yracub on May 19, 2016
Latest reply on May 20, 2016 by yracub

I am trying to format the Popup content in a way that, reading the documentation, I am not sure if it is possible or not.

 

I am consuming a layer through a REST service (published with ArcGIS Server). One of the available fields is

  • safe ( type: esriFieldTypeSmallInteger , alias: safe )

 

This field only has the values 0 and 1. In the Popup, I want to display these values as "No" and "Yes", respectively.

 

In the documentation, it says (emphasis mine):

 

The date or number formatting object. Fields of type date and number can be formatted by specifying a formatting function. The format will apply anywhere the field is used in the popup (title, description, media, etc).

 

What is exactly this formatting function? How should it be defined?

There is no available examples with this formatting function -- specifically for fields of type number.

I have tried the following, with no success:

 

{

    fieldName: 'safe',

    visible: true,

    format: function(x) {

        switch(x) {

            case 0:

                return "No"

            case 1:

                return "Yes"

        }

    }

 

I appreciate any suggestions.

Outcomes