<?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 Query datagrid with date field in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392416#M10171</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a query that provides the results in a datagrid.&amp;nbsp; All looks swell, except I have one field that is a date, in which I get the time (It's not there in the attribute table in ArcMap) &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure I am understanding how to get the attribute over to the datagrid formatted as I would prefer - either as a shortdate or even as a trimmed string.&amp;nbsp; In fact, in my testing I haven't even been able to pass over any custom text (say: string newvalue = "something";&amp;nbsp; ) I'm definately missing something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using silverlight 4; ArcGIS Server 9.3.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2011 16:14:24 GMT</pubDate>
    <dc:creator>DorothyMortenson</dc:creator>
    <dc:date>2011-08-12T16:14:24Z</dc:date>
    <item>
      <title>Query datagrid with date field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392416#M10171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a query that provides the results in a datagrid.&amp;nbsp; All looks swell, except I have one field that is a date, in which I get the time (It's not there in the attribute table in ArcMap) &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure I am understanding how to get the attribute over to the datagrid formatted as I would prefer - either as a shortdate or even as a trimmed string.&amp;nbsp; In fact, in my testing I haven't even been able to pass over any custom text (say: string newvalue = "something";&amp;nbsp; ) I'm definately missing something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using silverlight 4; ArcGIS Server 9.3.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 16:14:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392416#M10171</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2011-08-12T16:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query datagrid with date field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392417#M10172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use StringFormat property, here's an example of how it is used: &lt;/SPAN&gt;&lt;A href="http://mattduffield.wordpress.com/2011/02/14/data-binding-and-stringformat-in-silverlight/"&gt;http://mattduffield.wordpress.com/2011/02/14/data-binding-and-stringformat-in-silverlight/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 17:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392417#M10172</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-08-15T17:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query datagrid with date field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392418#M10173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, it's been interesting...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It appears that if you have a date field in your geodatabase, it returns as a string - with the time - in a query.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have added a converter class as described by:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://blogs.msdn.com/b/scmorris/archive/2008/03/27/defining-columns-for-a-silverlight-datagrid.aspx"&gt;http://blogs.msdn.com/b/scmorris/archive/2008/03/27/defining-columns-for-a-silverlight-datagrid.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was able to get the field to look correct with a short date (1/3/2011). However, it does not sort correctly (sort by year). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed my presentation of it in the converter class to be YYYY-MM-DD, However, the DataGridTextColumn is still sorting on the original field, which is a date as a string, so all the 1/ are together, dispite the day or year.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Part II:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I did find an easier way to present the date field in a short date:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;sdk:DataGridTextColumn Binding="{Binding Attributes[priority_date],StringFormat=\{0:d\}}" Header="Priority Date"&amp;nbsp; CanUserSort="True" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, this only works if the field was truly a date field. But since the query is returning a string, it cannot be formatted in this way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still working on a solution...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 17:29:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392418#M10173</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2011-08-15T17:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query datagrid with date field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392419#M10174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As it turns out, you cannot sort on number fields either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up creating my own class that defines all of the fields as the data type they are suppose to be.&amp;nbsp; I am then able to do with them as I wish.&amp;nbsp; Dates sort as they should (by year, month, day instead of by month).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you put a stop in your code just after the query finishes and look at the results, you will see that the results are a dictionary with either strings or numbers. It doesn't maintain the data types even as they are defined in the web service.&amp;nbsp; Seems crazy to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After defining these fields, it does add just a little bit of time to process, which seems a bit needless. I'm hoping ESRI can fix this in a future version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Aug 2011 17:26:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-datagrid-with-date-field/m-p/392419#M10174</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2011-08-18T17:26:10Z</dc:date>
    </item>
  </channel>
</rss>

