I want to keep 2 decimals for a variable in eSearch widget. Can I use numberformat to control decimals? The following code only keep integer. Thanks!
<field name="minor" alias="Percent Minority" numberformat="0|,|." gridfield="true"/>
Lei,
That is because you have the number of decimals set to 0 change it to 2.
<field name="minor" alias="Percent Minority" numberformat="2|,|." gridfield="true"/>
I tried this, but it seems nothing changed. I also change it to 4|,|. or 100|,|. Thanks!
What is the data type of the field? When I set the numberformat on any numeric field it works fine for me.
<field name="PPIN" gridfield="true" alias="Parcel Identifcation Number" numberformat="6|,|."/>
It is esriFieldTypeDouble; if I remove numberformat, the data goes back to original .**** four decimals
Thanks!
Can you attach your whole eSearchWidget.xml for me to look at?
<configuration> <layers> <layer> <definitionexpression></definitionexpression> <enableexport>false</enableexport> <name>Health Indicators</name> <url>I hide url since it is not public</url> <expressions> <expression alias="Census Tract" textsearchlabel="Search by Census Tract [Example: 48201532100]:" >ct_arr.FIPS LIKE '%[value]%'</expression> </expressions> <graphicalsearchlabel>Use a tool to select one or more Census Tracts</graphicalsearchlabel> <spatialsearchlayer>true</spatialsearchlayer> <titlefield></titlefield> <fields all="false"> <field name="ct_arr.FIPS" alias="Census Tract" gridfield="true"/> <field name="all.pop_per_sq" alias="Population Density" numberformat="0|,|." gridfield="true"/> <field name="all.pct_minor" alias="Percent Minority" numberformat="0|,|." gridfield="true"/> <field name="all.pct_black" alias="Percent Black" numberformat="0|,|." gridfield="true"/> <field name="all.pct_hispan" alias="Percent Hispanic" numberformat="0|,|." gridfield="true"/> <field name="all.pct_asian" alias="Percent Asian" numberformat="0|,|." gridfield="true"/> <field name="all.pct_povert" alias="Percent Below Poverty" numberformat="0|,|." gridfield="true"/> <field name="all.MHI" alias="Median Household Income" numberformat="0|,|." gridfield="true"/> <field name="all.pct_no_HS" alias="Percent Without High School Diploma" numberformat="0|,|." gridfield="true"/> <field name="all.pct_hsh_fe" alias="Percent of Female Head of Households" numberformat="0|,|." gridfield="true"/> <field name="all.avg_comm_t" alias="Average Travel Time to Work" numberformat="0|,|." gridfield="true"/> <field name="all.pct_no_veh" alias="Percent Households without a Vehicle" numberformat="0|,|." gridfield="true"/> <field name="all.bkw_ch" alias="Percent of Children Living within a 1/4 mile of a Bikeway" numberformat="0|,|." gridfield="true"/> <field name="all.bus_w" alias="Percent of Adults Living within a 1/4 Mile of a Bus Stop" numberformat="0|,|." gridfield="true"/> <field name="all.es_ch" alias="Percent of Children Living with a 1/4 mile of an Elementary School" numberformat="0|,|." gridfield="true"/> <field name="all.prk_pop" alias="Percent of Resdients Living within a 1/4 Mile of a Park" numberformat="0|,|." gridfield="true"/> <field name="all.int_sqm" alias="Intersection Density (street intersections per square mile)" numberformat="0|,|." gridfield="true"/> <field name="all.parks_sqm" alias="Parks per Square Mile" numberformat="2|,|." gridfield="true"/> <field name="all.grocery_sq" alias="Supermarkets per Square Mile" numberformat="2|,|." gridfield="true"/> <field name="all.fastfood_s" alias="Fast Food Restaurants per Square Mile" numberformat="4|,|." gridfield="true"/> <field name="all.supm_pop" alias="Supermarkets per 1,000 Residents" numberformat="0|,|." gridfield="true"/> <field name="all.ff_pop" alias="Fast Food Restaurants per 1,000 Residents" numberformat="0|,|." gridfield="true"/> <field name="all.PerObOvr" alias="Percent of Children Overweight" numberformat="0|,|." gridfield="true"/> </fields> <linkfield></linkfield> <icon isfield="false">assets/images/i_target.png</icon> <zoomscale>145000</zoomscale> <autoopendatagrid>true</autoopendatagrid> </layer> </layers> <spatialrelationships> <spatialrelationship> <name>esriSpatialRelContains</name> <label>entirely contained in</label> </spatialrelationship> <spatialrelationship> <name>esriSpatialRelIntersects</name> <label>interssected by</label> </spatialrelationship> <spatialrelationship> <name>esriSpatialRelEnvelopeIntersects</name> <label>intersected by envelop of</label> </spatialrelationship> </spatialrelationships> <bufferunits> <bufferunit> <name>UNIT_FOOT</name> <label>Feet</label> </bufferunit> <bufferunit> <name>UNIT_STATUTE_MILE</name> <label>Miles</label> </bufferunit> <bufferunit> <name>UNIT_METER</name> <label>Meters</label> </bufferunit> <bufferunit> <name>UNIT_KILOMETER</name> <label>Kilometers</label> </bufferunit> </bufferunits> <tolerance>6</tolerance> <spatialReference>102003</spatialReference> <zoomscale>2400</zoomscale> <geometryservice>http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer</geometryservice> <csvSeparator>,</csvSeparator> <toleranceforpointgraphicalselection>3</toleranceforpointgraphicalselection><!-- value is in screen pixels --> <disablebuttons></disablebuttons><!--possible values one or more not all three search types comma sepearted text,graphic,spatial,grid --> <defaultselectionoption>graphicalInput</defaultselectionoption><!--possible values only one graphicalInput or textInput or spatialInput --> <enabledrawgraphicbutton>true</enabledrawgraphicbutton> <labels> <addtolerance>Add search tolerance to point selection</addtolerance> <existingdrawgraphicslabel>Use Existing Draw Widget Graphics</existingdrawgraphicslabel> <graphicalsearchlabel>Graphical Search</graphicalsearchlabel> <textsearchlabel>Text Search</textsearchlabel> <resultslabel>Results</resultslabel> <layerlabel>Search Layer:</layerlabel> <layerfieldlabel>Search Layer Field:</layerfieldlabel> <nolayerlabel>No search layer defined.</nolayerlabel> <submitlabel>Search</submitlabel> <pointlabel>Select by Point</pointlabel> <linelabel>Select by Line</linelabel> <rectanglelabel>Select by Rectangle</rectanglelabel> <polygonlabel>Select by Polygon</polygonlabel> <clearlabel>Clear</clearlabel> <loadinglabel>Loading...</loadinglabel> <selectionlabel>Features Selected:</selectionlabel> <gridresultsLabel>Show Results in Grid</gridresultsLabel> <csvdefaultname>Selected Records</csvdefaultname> <exportbtnlabel>Export</exportbtnlabel> <export2csvoptionlabel>Export to CSV</export2csvoptionlabel> <export2txtoptionlabel>Export to Txt</export2txtoptionlabel> <bufferLabel>apply a search distance:</bufferLabel> <spatialsearchLabel>Spatial search</spatialsearchLabel> <applybufferlabel>Apply buffer</applybufferlabel> <searchlayerlabel>Search entities of:</searchlayerlabel> </labels> <info>widgets/InfoTemplates/InfoPopupWidget.swf</info> <symbols> <simplefillsymbol color="0x999999" alpha="0.9"> <outline color="0xff0000" alpha="0.8" width="2"/> </simplefillsymbol> <simplemarkersymbol style="circle" size="12" color="0x999999" alpha="0.5" xoffset="0" yoffset="0" angle="0"> <outline style="solid" color="0x000000" alpha="1" width="1"/> </simplemarkersymbol> <!--<picturemarkersymbol url="assets/images/i_search.png" height="30" width="30" xoffset="0" yoffset="0"/>--> <simplelinesymbol color="0xff0000" alpha="0.8" width="2"/> </symbols> </configuration>
I thought that there might have been a bug with the numberformat when using a joined field like you are, but I just tested that and it work fine for me... What version of the widget are you using?
We use 2.4 version and did not get a chance to update yet. Thanks!
This was something that was fixed after version 2.4 then. More reason to update to the latest version.
Thanks a lot!
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.