How to filter row path ??

Six Stars

How to filter row path ??

Hi all,

I have a csv file as an input with followings rows: 

/Default/Tools/Documents/Articles/Factures/
/Default/Tools/Documents/Articles/Factures/Factures_Comptable/
/Default/Tools/Documents/Articles/Factures/Factures_Comptable/Année

 

And I'd like as an ouput: 

/Default/
/Default/Tools/
/Default/Tools/Documents/
/Default/Tools/Documents/Articles/Factures/

/Factures_Comptable/

/Année

 

So when the second rows is read, it gave as an ouput /Factures_Comptable/ because the others variable has already been extract above. Same for the thirid row. I implemented the job below in order to filter my rows and keep only the data as shown in the example above. Could you recommend me any other solutions?

 

missingFolder.PNG

 

Thank you for your time and consideration. 

 

Warm regards,

 

Stevn

Employee

Re: How to filter row path ??

Hi Stevn,

 

     While the solution you have asked can be achieved by java custom code, I am wondering why we are doing this way? Could you please advise the original use case? Ideally we will give the entire file path while processing the data rather than keeping them as relative.

 

     If we are keeping them as relative, there is high chances of errors or missing data at later stages of your processing. So could you please advise the root cause of doing this exercise?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Six Stars

Re: How to filter row path ??

Hi

@nikhilthampi 

I'm a new in java, then the only thing that I did was split the entry path. I though there is a simple way with talend. Th idea is to run a csv with relative path and get a as an ouput (see bellow, output description) then we could which folders are missing. Here is my input csv: 

/Default/Usines/Articles_Documents/Projets/Projets_Divers/Diverses_Pieces/Montage/
/Default/Usines/Articles_Documents/Projets/Projets_Divers/56xxx/Montage/
/Default/Usines/Articles_Documents/Projets/Projets_Divers/59890/
/Default/Usines/Articles_Documents/Projets/Projets_Divers/00000/Finissions/
/Default/Usines/Articles_Documents/Projets/Projets_Divers/11111_GMT/
/Default/Usines/Outils/
/Default/Usines/Articles_Documents/Projets/Brossage/Fal.08xxx
/Default/Usines/Articles_Documents/Projets/Brossage/Fal.80xxx

 

When I run the job, I can Identified which folder are missing. this why I have to provide as an ouput a csv like:

/Default/

/Default/Usines/

/Default/Usines/Articles_Documents/

/Default/Usines/Articles_Documents/Projets/

/Default/Usines/Articles_Documents/Projets/Projets_Divers/

/Default/Usines/Articles_Documents/Projets/Projets_Divers/Diverses_Pieces/

/Default/Usines/Articles_Documents/Projets/Projets_Divers/Diverses_Pieces/Montage/

 

/56xxx/
/56xxx/Montage/

 

/59890/

 

/00000/

/00000/Finissions/

...

I attach my job as zip, so you can see if my java code could be better perform. Again thank you for your help

 

Warm regards,

 

Stevn 

 

Employee

Re: How to filter row path ??

Hi Stevn,

 

     Unfortunately I am using 7.1 enterprise version of Talend and I am not able to open your job due to version issues.

 

     But that is fine. What I am not convinced is the method to verify the missing folders. If you are having Absolute path, I will be more than happy to verify them quickly. I will use a tFileList option with FileList Type selected as "Both" or "Directories" to check whether the path exists by checking the error message in a tjava or some other component.

 

image.png

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Six Stars

Re: How to filter row path ??

Hi,

 

It's weird that you couldn't open the job. I'm using also Talend 7.1. The thing is, they want me to provide a csv files with the structured that I mentioned in my previous message. This is why I don't hava absolute path. I just have the input file such as the one attached here. May I ask you a way of how to inplement the entire job? 

 

Warm Regards

Six Stars

Re: How to filter row path ??

Hello,
Do you know if I can resolve it in an other way? I asked for absolut path, but I don't have access to it.

Thanks for your help
Employee

Re: How to filter row path ??

Hi Stevn,

 

       I saw your other post also where you have asked the same query. Unfortunately I do not have any quick solution to offer to get the relative path as per your specific use case. You can try to customize the solution provided by @manodwhb as it is the most close solution you have got till now.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download