Verify size and name ans save de value in a context variable

Highlighted
Six Stars

Verify size and name ans save de value in a context variable

Hello I have a problem.

 

I have a job that lists the .csv files in a directory, then using tFileproperties I output the information from each file and display it in a tLogRow. I create a context variable (context.last) and I assign it the name of the last file in the directory in a tJava.

job.PNG

 

I would like this when :I iterate in the directory;
if the size of a file = 0 then it stops the iteration and assigns the name of this file to the context variable (contest.last)
Otherwise context.last = the name of the last file.

please help here join the job

Highlighted
Community Manager

Re: Verify size and name ans save de value in a context variable

try this on tJavaRow:
context.last=input_row.baseName;
if(input_row.size==0){
break;
}
----------------------------------------------------------
Talend | Data Agility for Modern Business

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog