Summary : I need to export some CSV Files with Rows that are generated during Batch export.
I already do have an JdbcItemreader to get the Data from my DB. The Processor formats the OutputData to the required format. And i do have a basic FlatFileItemWriter that writes CSV-Files
This is what my Exported CSV-Lines look like:
040010;0006765;0001420;0008014;+00000018,00;+00000000,00;+00000018,00;+00000000,00;m06;100220;000014;030;CNAME;30;32
040010;0006765;0001420;0008014;+00000018,00;+00000000,00;+00000018,00;+00000000,00;m06;100220;000014;030;CNAME;30;32
I know that those lines look ugly but it is a requirement from the other CSV Importer. now i need to calculate "sum lines" which and add them before the two rows with identical Ids. The calculated "sum line" should look like this:
040010;0006765;0001420;0008014;+00000036,00;+00000000,00;+00000036,00;+00000000,00;m06;100220;000014;030;CNAME;30;31
So the final Output should look like This:
040010;0006765;0001420;0008014;+00000036,00;+00000000,00;+00000036,00;+00000000,00;m06;100220;000014;030;CNAME;30;31
040010;0006765;0001420;0008014;+00000018,00;+00000000,00;+00000018,00;+00000000,00;m06;100220;000014;030;CNAME;30;32
040010;0006765;0001420;0008014;+00000018,00;+00000000,00;+00000018,00;+00000000,00;m06;100220;000014;030;CNAME;30;32
Here are my Questions:
- is it possible to add lines between other lines in the CSV-File via FlatFileItemWriter ? or should i generate the sum lines before i write the File ?
- is it somehow possible to access the full data chunk in the ItemWriter / Processor ? so that i can maybe add the new lines to the chunk before writing them to the file ?