Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30353

Fix CUSTOM CSV Export broken with fields including carriage return characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 10.10
    • Fix Version/s: None
    • Component/s: CSV, Template Rendering

      Description

      What
      The CUSTOM CSV Export feature is described e.g. on https://doc.nuxeo.com/nxdoc/1010/how-to-export-data-using-document-template-and-automation/
      When generating such a CSV with fields including carriage return characters, the resulting CSV is flawed as was described in NXP-30078

      How to reproduce
      In Studio:

      • create a document type Doc with a schema doc including a String-typed field MyString
      • configure the JSF or WebUI screen enabling to create/modify/view the fields dc:description and doc:MyString with a textarea input
      • create a template > Document template named CSVExport and containing
        Title, Description, Creator, Creation Date, doc:MyString
        <#list This as doc>
        "${doc["dc:title"]}","${doc["dc:description"]}","${doc["dc:creator"]}","${doc["dc:created"]},"${doc["doc:MyString"]}"
        </#list>
        
      • create an automation chain MyCSVExport containing
        - Context.FetchDocument
        - Repository.Query:
            language: NXQL
            query: "SELECT * FROM Doc"
        - Render.DocumentFeed:
            template: "template:CSVExport"
            filename: MyCSVExport.csv
            mimetype: text/csv
            type: ftl
        - Seam.DownloadFile
        
      • configure a User Action in JSF or a button in WebUI active in Workspace or Folder and calling the previous automation chain MyCSVExport
      • Configure a Nuxeo 10.10 with HF up to 10.10-HF45
      • deploy the preceding project
      • create a Workspace or Folder
      • Create a Doc document with a dc:description field looking like
        this is
        a multiline
        description
        

        and a doc:MyString field looking like

        this is
        a multiline
        string field
        
      • come back in the workspace or folder and hit the custom buttom performing the custom export CSV and download the CSV file
      • edit the CSV file with a text editor and notice in the CSV file the newlines are included in the fields

      Caveats

      • reproduced as is, the CSV file is not broken as a CSV file: the carriage returns are included in fields with double quotes, this is common practice but not a standard
      • when you open the file in Excel, although there is only one title line and 1 document, the Excel displays more than 2 active lines => Sorting per columns is then impossible as giving meaningless result
      • SInce NXP-30078, the expectations are that multiline comments should appear as 1 single line => This is not the case here

      Discussion

      • If it is decided NOT to fix this ticket, should one advise to use the custom CSV Export feature as a workaround for fields including multiline values?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pabgrall Patrick Abgrall
                Reporter:
                pabgrall Patrick Abgrall
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 10 minutes
                  10m