Six 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.
6 REPLIES
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

Six 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.
Six 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

Six 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.