Trailing separator character?

  • Torsten

    Torsten - 2013-01-07

    I'm working with CSV files which must have a separator character as last character in the line. I'm using ';' as separator, so a line looks like this:
    Test;A entry;Some Text;The End;

    This line has 4 entries. If the last ';' is omitted the (very old) import code ignores the last entry.

    Now when I edit this line in RecordEdit and save the file sometimes the last character is deleted - I think this is the case if the last entry is empty, but even in this case the trailing ';' is important! Is there a way to ensure that trailing separator characters are always written to the file, particularly if the character existed before saving?


  • Bruce Martin

    Bruce Martin - 2013-01-08

    At the moment there in no way ensure each line ends with a seperator.
    I will look at making the changes to the RecordEditor to allow
    for this requirement.

    One option would be to write a macro to ensure each line ends with a seperator

    Can you provide some more details on:

    1) Which Record-Layout (Generic Csv, Comma delimited, Specific Layout etc)
    you use to edit the file
    2) An example file

  • Torsten

    Torsten - 2013-01-08

    Thank you for the quick reply and you effort! However I doubt that I can use this approach. I intended to use RecordEdit as a "simple" CSV editor for unexperienced users. The advantage is that I can define the CSV file layout like name the columns. The users only needs to run a batch file, edit the CSV file and click Save. I doubt that they can run a custom script before saving, let alone they won't forget it once or twice. So a change in RecordEdit is the only option that would help me.

    By the way: I don't (not only) need RecordEdit to append the trailing separator, but (also) keep existing ones. A line in my files ends e.g. with "350;350;". Now I change those two values to 370, the new line ends now with "370;370". So RecordEdit removes the trailing separator.

    The record layout is a custom CSV layout, but a very simple one. I'll attach the exported copybook and a part of the real data file.

  • Bruce Martin

    Bruce Martin - 2013-01-08

    Ok I will make the changes

  • Bruce Martin

    Bruce Martin - 2013-01-11

    I have released a new version (Upgrade jars / no installers)
    that contains some extra "Csv line parsers".

    I am not sure if you have noticed, on the extra screen there
    is a Parser field. This Parser controls which parser is used to break
    a CSV line into its fields (and update CSV lines).

    The new parser for you is

    • Basic - Delimiter all fields + 1
      • This parser will ensure there is a delimiter for every defined field
        (even when the field is not present) + an extra endo of line parser.
        If the user inserts a line, it will end up with the correct number of

    Alternatively there is:
    * Parser - Matching Quotes
    - This parser will leave all Delimiters in place, even when the last field / fields
    are deleted
    - One issue, if the user adds a line, it will not have the correct number of

    One other issue, In the editor, if you change the Layout to Full Line; you can change
    the raw text (and add / remove fields & delimiters).

    I will add a an option to disable access to the raw Text to close this loop hole


    Finally I have created 2 new Layout Definitions xml Exports using the Basic - Delimiter all fields + 1 and Parser - Matching Quotes. You can import them
    back into your system using Record Layouts >>> Load Copybooks


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks