LAE

 View Only
  • 1.  Export to csv

    Posted 11-15-2019 08:03

    NEW ISSUE (the issue below has been solved)

    export to csv/delim has 1 extra blank line!?

    how can I avoid this.. the file cannot contain any extra lines.

     

     

    SOLVED:

    I am trying to use the export to delim node...

    the problem is I need only certain fields to be quoted, so I pre-formatted all the data, i just need to basically spit it out to a csv.

    its erroring because it wants an escape char, but if i put something in there, it comes out in the file.

    if I put a quote char, it double quotes...

    so i need no field names, comma delim, and thats it. i have added the quotes and formatted everything as needed already.

    ****SOLUTION****

    got it... if anyone needs this... 

    Leave everything default, but use the same char in the quote as the field delim..

     

    in my case i combined all fields into one field and spit that out... then used | as the field and quote value since its not being used anywhere in the output.. it comes out PERFECTLY!!

    side note, combining the fields into one, allowed me to create a footer row and cat to the end of the data before outputting

     

     

     



  • 2.  RE: Export to csv

    Employee
    Posted 11-18-2019 03:01

    Is there an embedded line feed in one of the values?

     

    Here is a version of the logic that I was working on. It also concatenates all the the field values in a record into a single string. The logic handles Null values and provides a choice option of either removing embedded CR and LF characters or generating an error if one is found in the data. 

     

     

    Attached files

    Write_Preformatted_Text_to_CSV.brg

     



  • 3.  RE: Export to csv

    Employee
    Posted 11-18-2019 03:09

    The top Output Delimited node in the data flow uses alternative settings for the FieldDelimiter char (BEL) and QuoteCharacter (¬) and does not output the a header record.

    The lower Output Delimited File uses the settings you specified above. However, for it to be a valid file format the Header record should not be written (and possibly the logic upstream changed to generate a header record from the field names)



  • 4.  RE: Export to csv

    Posted 11-18-2019 06:34

    there is no linefeed in any lines, your code does the same thing.. the very last line is blank. its like its adding the linefeed char (as it should) on the last row... but that leaves a blank line at the end.

    its like i need to tell it to not add that final LF..

    the system that its getting loaded in is very picky and cannot have ANYTHING after the final row.

     

    *EDIT*

    the extra line might be ok, it looks like that final \n\r is ok and the file loads! fingers crossed!



  • 5.  RE: Export to csv

    Employee
    Posted 11-18-2019 09:26

    The Output Delimited node does not provide a control to not output a final empty line.

    You could modify the logic to output the data to a temp file and then use a Python node to read + write the file line by line and, and omit the final empty line:

     

    Attached files

    Write_Preformatted_Text_to_CSV_Picky.brg