Forum Discussion

heidi_andrew's avatar
heidi_andrew
Contributor
3 years ago
Solved

Merge files with varying column numbers

Continuing the discussion from Csv file with varying number of columns in each row: Here is what the file looked like when i started: EEID|55555|xxxxxxxxx|MICHAEL|C|xxxxx|M|06/21/xxxx OFFR|5555...
  • koryknick's avatar
    3 years ago

    Pulling back my original pipeline, I think this is what you’re asking for.
    Community 15513 - Multi-row CSV_2023_06_20.slp (31.6 KB)

    In the Mapper is the following expression:
    $.values().join('|')
    This simply gets the list of fields from the input document, which will vary depending on how it was parsed, and joins the values together with the pipe character, creating a single string as a pipe-delimited list of values. Then the pipeline is using the Fixed Width Formatter to write that string as-is to the file.