Extract FileName from tLogRow/tSortRow

Seven Stars

Extract FileName from tLogRow/tSortRow

am new to Talend and just trying to work my way through it. Have been trying to extract the most recent file from a list within a directory. Iterated through all the files, retained their properties in a buffer. Post completion of this sub-task, read through the buffer, sorted with descending mime, extracted the top record and was able to print it using tLogRow. All seems to be fine except I don't know how to use the filename now for next task. I am certain this is very rudimentary but I'll be honest, I've been scourging the internet/help from quite some time now, with no success. Any pointers would help. The job flow is attached for your reference.

 

All I need is a way to use the "abs_path" variable, which I can later use to process the file dynamically.

 

 

extract_filename.png

Ten Stars

Re: Extract FileName from tLogRow/tSortRow

Good job buddy, almost there!!!
get the iterate to a tFileInputDelimited component and where you put the file path and name ... use CTRL+SPACE and scroll for the tFileList1.CURRENT_FILEPATH and thats it. Like you did with the tFileProperties...

Now I assume you want tBufferInput -> tFlowtoIterate -> tFileInputDelimited to process the files.


Seven Stars

Re: Extract FileName from tLogRow/tSortRow

Thanks for responding.

Not sure if I followed your recommendation. Mind elucidating a bit? 

 

I can get all the needed information by my last node, as printed by the tLogRow. How do I pipe that to the tPositionalFile, is what I am confused about.

Seven Stars

Re: Extract FileName from tLogRow/tSortRow

Finally fixed the issue (and simplified the flow a little more). Utilized the tFileList component, used the tIterateToRow to pipe the iterated list into tSampleRow. Kept one record and used tSetGlobalVar component to capture the needed variables.

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

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now