Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Datetime field looks strange in CSV export.

    Hello,

    i have a listgrid that i'm doing a csv-export function for. I has a datasource that has datetime firlds:
    <field name="inTime" type="datetime" title="In time" required="true"/>

    I use the exportData method on the listgrid. The code to do this:

    DSRequest dsRequestProperties = new DSRequest();
    dsRequestProperties.setExportAs(exportFormat);
    dsRequestProperties.setWillHandleError(true);
    dsRequestProperties.setExportDisplay(display);
    dsRequestProperties.setAttribute("exportFilename", fileNameCreator.createReportName());
    if(reportFields != null){

    dsRequestProperties.setExportFields(reportFields);
    }
    dsRequestProperties.setExportDelimiter(delimiter);

    reportGrid.exportData(dsRequestProperties);


    My problem is that the datetime fields have leading zeros stripped out:
    Example: 2016-03-29 09:03:260.0 becomes "2016-3-29 9:3:26.0" in the csv file

    I am probably missing some config somewhere, but i cannot for the world find it.

    If you have any ideas what i can look at, it would be appreciated. Thanks.
    Last edited by mathias; 3 Apr 2016, 23:51. Reason: cleaned up code examples

    #2
    To clarify where i've looked. In your "exportformat" JavaDoc page, you write:

    if targetting CSV, XML or JSON, by default, formatting declarations are ignored and standard formats are used, because the expectation is that this type of export is intended for data interchange with other systems and not for direct viewing by end users. Specifically, date and datetime values use standard XML Schema date and time formats and CSV export uses the "yyyy-MM-dd HH:mm:ss" expected by Microsoft Excel and similar tools that consume CSV.

    This is not what i'm experiencing, as i explain above.

    https://www.smartclient.com/smartgwt...ormatting.html

    Comment


      #3
      We've made a change to address this issue. Please try the next nightly build, dated April 9.

      Regards
      Isomorphic Software

      Comment


        #4
        I can confirm it works my end. Thanks!

        Comment

        Working...
        X