NumberFormat(round:x) won't display anything less than 3 decimals

1538
2
Jump to solution
03-24-2016 09:52 AM
DonaldLund
New Contributor II

Does anyone know why using this construct in an infowindow won't allow me to display anything less than three decimal places?

Here is the complete construct:

var resTemplate = new InfoTemplate();

    resTemplate.setTitle("Customer Residence");

    resTemplate.setContent(

      "<b>Distance to Store: </b>${MI_TO_STORE:NumberFormat(round:2)} miles");

I have tried using both 2 and 1 and even changing the format of my data layer before publishing it to 2 decimal places, but the infowindow insists that it give me three decimal places.

Thanks in advance for any suggestions or insights.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Donald,

  The proper format is this:

${MI_TO_STORE:NumberFormat(places:2)}

it is places not round.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Donald,

  The proper format is this:

${MI_TO_STORE:NumberFormat(places:2)}

it is places not round.

DonaldLund
New Contributor II

Thank you. That did the trick. I'm almost sure I saw example code where the code listing used 'round', but 'places' did actually display the desired 2 decimal places.

Yes. Here's where I saw 'round' in use:

Format dates in an info window | ArcGIS API for JavaScript

I'm not arguing that it should work, just saying a search on 'arcgis javascript api round' led me there.

Thanks again

0 Kudos