Announcement

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

    BatchUploader and duplicate columns

    One doubt I have remaining is the handling of duplicate columns.
    It seems that if a duplicate column is added at the end of the CSV file, this duplicate column's additional value is ignored. Instead, if the duplicate column is among the other columns, the value on the right most column is loaded in the grid.
    I could not find any documentation on duplicated column, can you please summarize what's the expected behavior?
    I would check and refuse to upload a CSV file if it contains duplicated columns, but I could not figure out how to do that, since I don't see a way to get the file (or its content) that gets sent when the user clicks the Upload button. Is there such a way?
    Thanks.

    #2
    We've moved this question to it's own thread.

    The behavior in this case is unspecified, but it looks like it would basically be first-wins.

    The only way to modify the handling here would be to modify batchUploader.ds.xml to call your own DMI instead, parse the uploaded file (redundantly, unfortunately), detect the duplicate column and return an error response (dsResponse.setFailure()).

    When the CSV does not contain errors, your DMI should call the BatchUpload.batchUpload() API that is listed in batchUploader.ds.xml and return whatever it returns.

    This method wasn't technically documented even though it's intended as an API that you can call for this limited purpose. We've just added the documentation below; there's been no behavior change.

    Code:
        /**
         * Takes an DSRequest sent by the BatchUploader UI component, which contains an uploaded
         * CSV file and target DataSource, and returns a DSResponse containing the rows validated
         * against the target DataSource.
         * <P>
         * This API may only be used by the BatchUploader UI component.  It is documented solely to
         * allow pre- or post-processing checks to be added as a substitute DMI for the default DMI
         * declared in <code>batchUpload.ds.xml</code>.  
         * <p>
         * For checks involving the uploaded file, the binary field name is always "file" (so
         * getUploadedFileStream("file") allows access to the uploaded CSV InputStream, just as it
         * would for any other binary field named "file").
         * <P>
         * <b>NOTE:</b> the BatchUploader feature as a whole is only available with a Power or
         * better license.
         * 
         * @param dsRequest inbound DSRequest containing the uploaded CSV file
         * @return DSResponse containing the rows parsed from CSV, with validation errors if any
         * @throws Exception if an exception occurs during validation
         *
         * @visibility external
         */

    Comment


      #3
      Thanks, I'll investigate it

      Comment

      Working...
      X