how to use the useThousandsSeparator property

2143
5
04-20-2011 01:57 PM
CameronBrown
New Contributor III
Been reading the documentation under PopUpFieldInfo for the Flex API, and it seems like I should write the popupconfig file like this:

<field name="SITUS_NBR" alias="Number" visible="true">
         <format useThousandsSeparator="false" />
        </field>

But this doesn't take out the comma in the number field in the pop up window.  Does anyone know the right syntax to use to achieve this?
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor
Cameron, 

First thing is the correct syntax for the XML file is

<field name="SITUS_NBR" alias="Number" visible="true">
   <format usethousandseparator="false" />
  </field>


Notice the case and the missing "s" after thousand.

   If you are one that is using the FlexViewer source code than you can fix the BUG that is causing this.

In the MapManager.mxml line 980.

is Currently (BUG):

pFieldInfo.format.useThousandsSeparator = fields.format.@usethousandseparator;


needs to be (FIX):

pFieldInfo.format.useThousandsSeparator = fields.format.@usethousandseparator == "true";
0 Kudos
CameronBrown
New Contributor III
Thanks Robert.  Unfortunately, I am just using the sample viewer and not compiling source code.   Do you think this will be fixed by the sample viewer team in an update?  Since pop-ups were a big part of this version it seems like it would be pretty important to fix...but there's only so much complaining I can do when talking about a free viewer.

Also, why is it 'usethousandseparator' when the api reference says 'useThousandsSeparator'?
0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor
Cameron,

   I am not sure about the priority of getting an update out but I would say it might come quickly as there is a MAJOR bug in the API that prevents snapping and editing when the map is any other wkid than webmercator or geographic.

The reason (partially) for the usethousandseparator being different in the viewer than in the API is that esri uses a standard of having all attributes in the config files lowercase for consistancy. As to why they left out the "s" is anyone's best guess.
0 Kudos
BjornSvensson
Esri Regular Contributor
This will be fixed in the next release - 2.3.1 - which is planned for release later this week.  Also the property name will be spelled with two s's to be consistent with the API.
0 Kudos
SveinungRaheim
Occasional Contributor
I have a problem with the thousand separator. I have an integer-field (ID-field) in this rest-service (http://askeladden_wms.ra.no/ArcGIS/rest/services/Askeladden/Kulturminner_ReadOnly/MapServer/1) which I want to include in a rather complex url to be able to open an external database with information about features in the service:
http://www.kulturminnesok.no/content/search?search=9373&searchtype=1&county=&municipality=&culture_e...

I have created a custom pop-up that looks like this:
http://www.kulturminnesok.no/content/search?search={LokalitetID}&searchtype=1&county=&municipality=&culture_environment=0&man_em_dating=0&category=&em_art1=&em_category=&em_date=&conservation=&em_old_function=&submit=S%C3%B8k

The important field heire is {LokalitetID}. This is returned in the flex-viewer pop-up (standard pop up, version3.5) with the thousand separator ",". That means, instead of "113224" it returns "113,224". This makes the URL invalid.

By chance or maybe pure luck, I found a workaround.
In the xml-file for the spesific pop-up, I had to add theese two lines:

            <format precision="-1" usethousandsseparator="false" useutc="false" dateformat="shortDateShortTime"/>
        </field>

The whole xml-file looks like this:

<?xml version="1.0" ?>
<configuration>
    <title>{Navn}_1</title>
    <description><![CDATA[<a href="http://www.kulturminnesok.no/content/search?search={LokalitetID}&searchtype=1&county=&municipality=&culture_environment=0&man_em_dating=0&category=&em_art1=&em_category=&em_date=&conservation=&em_old_function=&submit=S%C3%B8k">Faktaark - kulturminnesøk</a>]]></description>
    <fields>
        <field name="LokalitetID" alias="LokalitetID">
            <format precision="-1" usethousandsseparator="false" useutc="false" dateformat="shortDateShortTime"/>
        </field>
        <field name="Navn" alias="Navn"/>
        <field name="BegrensetOffentlighet" alias="BegrensetOffentlighet"/>
        <field name="Tag" alias="Tag"/>
        <field name="GlobalID" alias="GlobalID"/>
        <field name="KategoriID" alias="KategoriID"/>
        <field name="VernetypeID" alias="VernetypeID"/>
        <field name="KommuneNummer" alias="KommuneNummer"/>
    </fields>
    <showattachments>false</showattachments>
    <showrelatedrecords>false</showrelatedrecords>
</configuration>


I dont know why the flexviewer add "use utc" and "dateformat", but it seems like you have to specify this value:
usethousandsseparator="false"
It looks like "true" is the default value, a bit confusing that in the builder, you have an option to check it on.

Anyway, this looks like a solution for me.
0 Kudos