<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to format numeric attribute values in an infoWindow in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247496#M22915</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This question comes up frequently so I added a new sample to the ArcGIS Resource Center this morning showing how to format the contents of an info window.&amp;nbsp; The sample formats string values but could easily be modified to apply numeric or date formatting. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/fl_infowindow.html"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/fl_infowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI: We are making some changes at 2.2 that will simplify this process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Nov 2010 15:57:37 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2010-11-11T15:57:37Z</dc:date>
    <item>
      <title>How to format numeric attribute values in an infoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247493#M22912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to format attribute values in an infoWindow?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, see the sample at &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/query/query_hover.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/query/query_hover.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The infoWindow template uses population density values from attribute values in a variable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;infoTemplate.setContent("&amp;lt;b&amp;gt;2000 Population: &amp;lt;/b&amp;gt;${POP2000}&amp;lt;br/&amp;gt;"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + "&amp;lt;b&amp;gt;2000 Population per Sq. Mi.: &amp;lt;/b&amp;gt;${POP00_SQMI}&amp;lt;br/&amp;gt;"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + "&amp;lt;b&amp;gt;2007 Population: &amp;lt;/b&amp;gt;${POP2007}&amp;lt;br/&amp;gt;"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + "&amp;lt;b&amp;gt;2007 Population per Sq. Mi.: &amp;lt;/b&amp;gt;${POP07_SQMI}");&lt;/PRE&gt;&lt;SPAN&gt;Is it possible to apply formatting to these values, eg so the POP07_SQMI value is rounded to zero decimal places?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247493#M22912</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2021-12-11T12:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to format numeric attribute values in an infoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247494#M22913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;not sure if there is a fancy way to do it, but the boring javascript way is to just use Math.round&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for example,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Math.round(2232.43534) //returns 2232&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so you could do something like,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var popRounded = Math.round(POP07_SQMI);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 01:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247494#M22913</guid>
      <dc:creator>BradCochran</dc:creator>
      <dc:date>2010-11-11T01:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to format numeric attribute values in an infoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247495#M22914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Brad,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply. As far as I can see, the problem is that the &lt;/SPAN&gt;&lt;STRONG&gt;value &lt;/STRONG&gt;&lt;SPAN&gt;of the attribute isn't evaluated at the time that the infoTemplate is created (so there's nothing to round yet). The code is setting up a template that is read at the point at which the graphic object is created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Put another way - I can't see how to put the Math.round directive in the code above, and have it run as JavaScript, rather than being quoted as text. I'm not a JS expert.......&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 02:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247495#M22914</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2010-11-11T02:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to format numeric attribute values in an infoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247496#M22915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This question comes up frequently so I added a new sample to the ArcGIS Resource Center this morning showing how to format the contents of an info window.&amp;nbsp; The sample formats string values but could easily be modified to apply numeric or date formatting. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/fl_infowindow.html"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/fl_infowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI: We are making some changes at 2.2 that will simplify this process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 15:57:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247496#M22915</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2010-11-11T15:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to format numeric attribute values in an infoWindow</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247497#M22916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks again Kelly, I'll give it a go.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would definitely be nice to be able to include the formatting directions in the infoWindow template, rather than having to listen for the click event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 23:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-format-numeric-attribute-values-in-an/m-p/247497#M22916</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2010-11-11T23:19:29Z</dc:date>
    </item>
  </channel>
</rss>

