Announcement Announcement Module
Collapse
No announcement yet.
database to flat file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • database to flat file

    Hello everyone,

    Is it possible to write the row count on the flat file along with the chunk size and also i have a amount column in a row i need to add them up in every page .when i go through the spring batch in action i think field extractor interface is one of the option .can anyone please help me in this .please suggest me what should i do ?is it possible to calculate the amount in every page ?

    Thanks in advance

  • #2
    Hello satz,

    Of course, in the StepExecution bean you have the row.count value. To get it, first in the @BeforeStep get the StepExecution parameter and define a new variable in your process of type StepExecution (and @Autowired it). Then, you can use all the counters that the StepExecution manages.

    Hope to hep you. If you have any other question, please let me know.


    Regards,

    Comment


    • #3
      Can we add column data

      Hi maxjuiz,

      Thank you for your response ,so using StepExecution i can get the rowcount to be shown on flat file but what about the column data ,I have a column with the amount which have some have value on each row ,i need the sum of all for every chunk .how can i do that ? can you please suggest me

      Thank you ..

      Originally posted by maxjuiz View Post
      Hello satz,

      Of course, in the StepExecution bean you have the row.count value. To get it, first in the @BeforeStep get the StepExecution parameter and define a new variable in your process of type StepExecution (and @Autowired it). Then, you can use all the counters that the StepExecution manages.

      Hope to hep you. If you have any other question, please let me know.


      Regards,

      Comment


      • #4
        The easiest way to handle the aggregation you're talking about is going to be to write your own writer that wraps the FlatFileItemWriter. You can aggregate the records in each chunk there and delegate all actual writing work to the FlatFileItemWriter.

        Comment

        Working...
        X