Announcement

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

    exportClientData without quotation marks

    Hello,

    Is there a way to suppress the quotation marks when I export as csv file with exportClientData?
    Kind regards

    Paul

    #2
    They are required for cases like commas embedded in data values.

    Are you hoping to remove them for cases where they aren't needed? If so, why? The parsing software still needs to be able to deal with quotes for the case of embedded commas.

    Comment


      #3
      Yes, it is a better approach to use quotation marks, but some of our customers use software products that can only import data from files without quotation mark. Those small companies have also difficulties to process downloaded data with scripts (powershell, awk, sed etc.) that could manipulate the file before importing the data.

      Comment


        #4
        OK, we understand.

        While we could introduce a feature to take a CSV and re-process it into a not-quite-CSV format that works with the legacy systems you have in mind, that seems like something more appropriate to do in application logic, where you can also decide which particular way of mangling the data (replacing commas and so forth) would be least damaging for your particular data.

        With off-the-shelf CSV parsers available for Java, this should only be maybe 30-ish lines of code.

        The only consideration might be if you are doing a very, very large CSV export and need to use our streaming CSV export feature. In that case you might consider Feature Sponsorship to have the not-quite-CSV mode integrated as a framework feature. But bear in mind, there are already APIs to do your own streaming export (see the server-side API DSResponse.nextRecordAsObject / hasNextRecord https://smartclient.com/smartgwt-12....cordAsObject--) so you could do a not-quite-CSV export using those APIs without framework changes.

        Comment


          #5
          Thank you for your quick answer.
          I'am using REST-Datasources and cannot make use of your server side api. I tried to use "exportData" with exportAs: "custom" and operationId: "customExport" but the auto generated url leads to a wrong server page(object).
          I will try something else...
          Kind regards Paul

          Comment


            #6
            Are you saying that you are hoping for exportClientData() (with no server involvement) to produce this pseudo-CSV format?

            If so, the code in JavaScript to produce pseudo-CSV from JSON data is quite short. Here's an example: https://stackoverflow.com/questions/...uotation-marks.

            This won't export extremely large CSVs because of course client-side export cannot do that in general (in any system), so that is thankfully not a concern here.

            Comment


              #7
              No, I'am saying that I will have to make a server call without using SC components.
              Kind regards Paul

              Comment


                #8
                OK. If you are making a server call without SmartClient components, you will not be using SmartClient components to generate the CSV. So in that case you do not have to worry about the default format that the SmartClient server produces, so we're not sure what the original question meant.

                But in case you are in fact using SmartClient server components, and you meant simply that you will be doing your own export, please revisit our post #4: you can use the SmartClient Server's built-in support for exports, including its support for do streaming exports of extremely large datasets, but you can still export whatever format you like, including pseudo-CSV if that's what you want.

                Comment


                  #9
                  My original question meant that it would have been a very small amount of work if there would have been a simple sc property/method to eliminate quotation marks.
                  My Server language is Progress OOGL(REST). I cannot use smartclient server components. But you are right: It will be done in some line of codes, but no lines would be even better and I have to add additional code to the javascript client and Progress Server components and because I have some more csv interfaces for old customers it will be some work to do.

                  Comment

                  Working...
                  X