Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
TharunJoshi
Contributor III
Contributor III

Header and footer with row count

Hi
I have a quick question related to header and footer
I have an Excel file which needs to be converted to pipe delimited before fetching first record I need to get current date and a pipe delimited with how many records or sent into text file
Example: 20200525|850
After processing the file
at the end of the file it should say as END
Labels (3)
2 Replies
TRF
Creator III
Creator III

Add a subjob with these components tFixedFlowInput --> tFileOutputDelimited.

This subjob must be connected by an OnSubjobOk trigger to the subjob where the Excel file content is transfered to the output file. 

For tFixedFlowInput, create a 2 fields schema (today and records) then complete the table with the following values:

  • today: TalendDate.formatDate("yyyyMMdd", TalendDate.getCurrentDate())
  • records: ((Integer)globalMap.get("tFileOutputDelimited_1_NB_LINE"))
    here, tFileOutputDelimited_1 is supposed to be the output component where records have been written from the Excel file

For tFileOutputDelimited, reuse the same file name as for tFileOutputDelimited_1, select | as the field separator and tick the option "Appen" to write the next record at the end.

This should work.

BhavikaW
Contributor III
Contributor III

Hello,

Since you need to get the current date before fetching the 1st record, you can use tjava and store current date in the required format in globalmap and then onsubjobok, the flow to read data from excel and loading to pipe delimited file will run and then again on subjobok, use tfixedflowinput which will have schema with 2 columns; in 1st column you will retrive the value from globalmap date variable and in 2nd column you will use nbline variable of input excel component and store the value in 2nd column of fixedfowinput.

Don't forget to give Kudos if you find the reply useful.

Regards,

BhavikaW

BhavikaW