Select to view content in your preferred language

Attribute Table Date Format

3785
6
05-05-2013 12:41 AM
RafaelCruz1
New Contributor II
Hi,

Anybody knows how i can change the Attribute Table (For Flex viewer 3.3) to format a date field to dd mmm yyyy (05 May 2013)?

Regards,
Rafael
Tags (2)
0 Kudos
6 Replies
ScottMcGee
Occasional Contributor
I too have an issue with formatting dates in the Flex 3.3 attribute table widget. In my case, all the dates shown in the attribute table are one day earlier than the date that I have in the SDE geodatabase. So for example, if a date in the GDB is 1/10/2012, then the date that shows in the Flex attribute table is 1/09/2012.

My GDB has editor tracking enabled, which assigns UTC dates to the edit_date field when a feature is edited. But this does not affect other date fields that I have in the feature class.

I had the same one-day-earlier problem for date fields in several of my pop-ups. I was able to solve that problem by adding the following to my popup.xml:

<field name="Cvydate"><format dateformat="shortDate" useutc="true"/></field>


I then tried the same thing in my AttributeTableWidget.xml file, but it doesn't have any effect on the date field. Here's the section from my XML file:

    <layersettings>
        <layer name="Surface (USFWS)">
            <fields>
                <field name="Refuge" alias="Refuge"/>
                <field name="NWR_Unit" alias="Unit"/>
                <field name="LRS_Tract" alias="LRS Tract"/>
                <field name="OWNTYP" alias="Owner Type"/>
                <field name="Casetype" alias="Case Type"/>
                <field name="Surstat" alias="Surface Status"/>
                <field name="Serial_full" alias="Serial No."/>
                <field name="Cvyno" alias="Conveyance No."/>
<field name="Cvydate"><format dateformat="shortDate" useutc="true"/></field>
                <field name="Acres_LGL" alias="Acres (Legal)"/>
                <field name="Acres_GIS" alias="Acres (GIS)"/>
                <field name="USS" alias="USS No."/>
                <field name="Lot" alias="Lot"/>
                <field name="Block" alias="Block"/>
                <field name="Survey_Tract" alias="Tract"/>
                <field name="Notes" alias="Notes"/>
            </fields>



I've highlighted the relevant line in red text above. I've tried both useutc="true" and useutc="false", but neither one has any effect. The date shown in the Flex attribute table is still one day earlier than the correct date that's in the SDE GDB.

Am I putting the field formatting tag in the proper place in the AttributeTableWidget.xml? I've tried putting it before the <layersettings> tag but that didn't work either. Or do I just have a simple syntax error somewhere?
0 Kudos
ScottMcGee
Occasional Contributor
This is a continuation of my previous post above.

After more experimenting, it appears that the Flex 3.3 attribute table does not accept any kind of field formatting for date fields. See the red highlighted line below:

    <layersettings>
        <layer name="Surface (USFWS)">
            <fields>
                <field name="Refuge" alias="Refuge"/>
                <field name="NWR_Unit" alias="Unit"/>
                <field name="LRS_Tract" alias="LRS Tract"/>
                <field name="OWNTYP" alias="Owner Type"/>
                <field name="Casetype" alias="Case Type"/>
                <field name="Surstat" alias="Surface Status"/>
                <field name="Serial_full" alias="Serial No."/>
                <field name="Cvyno" alias="Conveyance No."/>
                <field name="Cvydate"><format dateformat="shortDate" useutc="true"/></field>
                <field name="Acres_LGL" alias="Acres (Legal)"/>
                <field name="Acres_GIS" alias="Acres (GIS)"/>
                <field name="USS" alias="USS No."/>
                <field name="Lot" alias="Lot"/>
                <field name="Block" alias="Block"/>
                <field name="Survey_Tract" alias="Tract"/>
                <field name="Notes" alias="Notes"/>
            </fields>

I tried both shortDate and longDate for dateformat, and both true and false for useutc. But none of these had any effect on the date shown in the Flex 3.3 attribute table. So it appears that it's not possible to format dates in the attribute table. If this is true, then this seems like a bug that needs to be squashed, or a limitation that needs to be fixed.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Scott,

   You will NOT find anywhere in the documentation that the Attribute Table widget supports field formatting. This has been requested as an enhancement already though.
0 Kudos
MatthewGubitosa
New Contributor III
This appears to have been addressed in 3.4:

http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Attribute_Table_widget_tags/01m...

I'm still having trouble getting the "Export to CSV" from the Attribute Table to output anything other than a 13-digit number where the date should be.  Has anyone figured this out?
0 Kudos
MehulChoksey
Esri Contributor
There are couple of things here:

1. Display formatted date using format string in Attribute table - Not supported in Viewer 3.3. Supported in Viewer 3.4.

2. Export To CSV Date values (and Domain values) as displayed in Attribute Table - Works fine in 3.3. Broken at 3.4. This is a bug. Thanks for reporting.

3. useutc - Not supported in Viewer 3.3. Supported at Viewer 3.4.

4. Example config for specifying date formatting at Viewer 3.4 for attribute Table:
 <?xml version="1.0" ?>
<configuration>
    <layersettings>
        <layer name="Units">
            <fields>
                <field name="combateffectiveness" required="false" useutc="false" alias="Combat Effectiveness"/>
                <field name="Date1" required="false" useutc="false"  dateformat="M/D/YYYY L:NN:SS"    alias="Date Time Unit Valid"/>
                <field name="Date2" required="false" useutc="true"  dateformat="longDate"    alias="Date Time Unit Valid"/>
            </fields>
        </layer>
    </layersettings>
</configuration>



5.Date format strings:
you can use any of the values of constants  (the ones in lowercase) at:
https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/portal/supportClasses/PopUpFieldFor...
or at
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html
0 Kudos
MatthewGubitosa
New Contributor III
In 3.4 the dateformat option for <field> also works fine in the Query results popup, but it can't be put in via the Viewer, the widget XML must be edited directly.
0 Kudos