One Star

Include line number in a csv rejects

Hi,
I'm working on a simple job (i attached a screenshot) :
- I've got a csv file with a schema composed of only string fields except one which is a Date.
- Then, a Tmap convert this csv file into an xml file. As you can see on the second picture below showing the mapping, the inputs fields are just transfered to the output fields. There are only two actions made in the mapping :
1) Convert the date format of the date field.
2) Create a new output field using the numeric sequence function in order to add a line number to each input row.
- To finish, i've got a Tlogrow that receives the rows rejected by the csv file. In this case, the rejects can only come from an unparseble date in my date field (cause every other fields are Strings).

I would like to had an information to the rejects row : the line number. The point is that the line number is calculate or informed only if the row goes into the Tmap with the sequence function. But the row is rejected before the Tmap, so i don't have this information.
I guess that the rows are processed one by one, isn't it ? Thus, the iteration counter used by the sequence function may be saved in a global variable somewhere. Is it possible to manually read or increment the value of this variable ?
Actually the question is, how could i do to add the line number to the rejects rows if i don't have this information in my csv file ?
Regards,
3 REPLIES
One Star

Re: Include line number in a csv rejects

the easiest way is to create a temporary file which is a copy of your file with a new column.
One Star

Re: Include line number in a csv rejects

You have to do the same tMap for your error stream:
The first parameter of "Numeric.Sequence", in your example "s1" defines the sequence itself. So the numer would be incremented on the main and the reject stream.
Bye
Volker
One Star

Re: Include line number in a csv rejects

Hi,
Thanks for your answers Smiley Wink