Customer Portal

Write field names in a data app when downloading file as CSV

Comments 2

  • Avatar
    Lukas Cholasta
    • Official comment
    Comment actions Permalink

    Hi Brandon,

    The workaround you used is definitely usable in many use-cases and I'm sure a preferable one in many. Just for the record, there is indeed no button to enable the header row to be written out.

    Another workaround is to manually iterate through the record fields and write out the column names as a regular record. You can use a DataGenerator component for this. You'll need to use phases to make sure the column names are going to be the first record in the resulting file. Then you can use a SimpleGather component to join the records one after another, more specifically, the names first and the actual data after that.

    Since our forum platform doesn't allow for sharing files other than images, attached is a link to FileTrasfer.io website that contains a file called test.rjob that demonstrates this technique and should give you a better idea on the concept.
    https://filetransfer.io/data-package/L64MrpF2#link

    Kind regards,

    Lukas

  • Avatar
    Brandon Russell
    0
    Comment actions Permalink

    After further playing with this. I added a datawriter, choosing to write field names and set the file output to response:body. Then remove any output edges, and change the DataApp output to custom, text/csv. Now I have a download file with headers. You loose the web preview of the data before downloading, but at least I have headers now. Just incase this helps someone.

Please sign in to leave a comment.