Read first/last row of XML

Seven Stars

Read first/last row of XML

How to read first and last row of XML file.

 

 

Thanks in advance

 

Regards
Aashish
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: Read first/last row of XML

Hi,

 

     While reading the file, you can pass the ((Integer)globalMap.get("tFileInputXML_1_NB_LINE")) parameter also to the subsequent data flow and use this value to pick the first and last rows.

 

Warm Regards,

 

Nikhil Thampi

Seven Stars

Re: Read first/last row of XML

where should I pass NB_LINE

Regards
Aashish
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Seven Stars

Re: Read first/last row of XML

or is there any way to read a file in reverse order like the last record then second last and so on.

Regards
Aashish
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Employee

Re: Read first/last row of XML

Hi,

 

     My sincere apologies as I read the requirement slightly different way. If you want to read the line numbers for each column, the best way is to add a sequence and transfer the data to an additional line number column.

 

     I have shown it for a delimited file but the theory remains same for xml file also.

image.png

 

 

Warm Regards,

 

Nikhil Thampi

Employee

Re: Read first/last row of XML

Hi,

 

     Once you got the line numbers for each row, you can choose the data in any order using a tsortrow and tfilterrow components.

 

Warm Regards,

 

Nikhil Thampi

Seven Stars

Re: Read first/last row of XML

actually, we are just finding the shortest/smartest way to validate XML files.

Regards
Aashish
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download