Output row number and sheet in Excel using JAVA

One Star

Output row number and sheet in Excel using JAVA

Hi ,
I'm a newbie in Talend, currently I'm stuck in getting the row number and sheet of a particular row in the Excel file which got error. After
searching through the forum , I found one post which is exactly what I need (http://www.talendforge.org/forum/viewtopic.php?id=2645) .
But there's one problem , I'll need to do this in JAVA. Can anyone help me please ?
Regards,
John
One Star

Re: Output row number and sheet in Excel using JAVA

Hi ,
To make things simple , I would only like to get the row number during output. But the NB_LINE keeps giving me null .
I would just like to know whether there is any method which returns the row number on the fly ? Hope to get a feedback
from anyone. Thanks.
Regards,
John
Community Manager

Re: Output row number and sheet in Excel using JAVA

Hello John
Which version of TOS do you use? I test NB_LIKE on TOS3.1.3 and it works fine. See my screenshot.
Note: the global var NB_LINE is only vailable after the subjob finished.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Output row number and sheet in Excel using JAVA

Hi Shong,
Thanks for your reply. I am using version 3.0.2 . I just found out that NB_LINE will only be
executed after the subjob is completed this morning. I got null values before due to I placed
NB_LINE within the flow. But this did not solve my problem. I'm currently trying to get row numbers
of data which are rejected by the database. This mean I will have to get the row number on the
fly. Is there any way I can do that ?
Regards,
John
Community Manager

Re: Output row number and sheet in Excel using JAVA

Hello
I'm currently trying to get row numbers
of data which are rejected by the database.

Please upload a screenshot of your job. and what are your expected result?
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Output row number and sheet in Excel using JAVA

Hi Shong,
Sorry for the late reply. Had being busy lately. From the attached image, I am supposed to
read an excel file which consist of many rows of data, do some conversion and input to an
oracle table. If the oracle gave me an error while processing a row of data(etc unique contraint ,
primary key contraint), the row of data will then be sent to the file error table. In my file error
table, I will need to specify which row is the rejected data from. If the faulty data is from 5th row,
there's a ROW column in my table which shows 5. It is quite similiar to the situation to the link I
posted earlier. I tried to use whatever components which may be able to return me a particular
row number but with no success. Thanks in advance for your attention.

Regards,
John
One Star

Re: Output row number and sheet in Excel using JAVA

Hi John,
add a Numeric.Sequence to your job (in tMap or tJavaRow). This way you could create a row number.
Bye
Volker