Extract FileName from tLogRow/tSortRow

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


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

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