Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ANguyen1685543904
Contributor
Contributor

How to process multiples files only for a day before using Talend?

I have used tFileList in Talend to get files from a VM remote, which will be generated each day. I want to I want to pick files only for the past hour and do the required processing. I have referred to this question in StackOverflow like below : 

How to process files only for the past hour using Talend?

I am stuck at step of writing code in tJavaRow. The error is : # "output_row cannot be resolved to a variable" Here is my job : .

0695b00000luzRSAAY.png

Here is my code in tJavaRow_1 :

((String)globalMap.get("tFileList_5_CURRENT_FILEPATH")) = input_row

Date lastModifiedDate = TalendDate.parseDate("EEE MMM dd HH:mm:ss zzz yyyy", input_row.mtime_string);

Date current_date = TalendDate.getCurrentDate();

if(TalendDate.diffDate(current_date, lastModifiedDate,"dd") <= 15) {

output_row.abs_path = input_row.abs_path;

}

Could you help my to resolve this error.

I have tried some solutions but it didn't work. Like changing output_row to tJavaRow_1 or Output because I see this schema of tJavaRow_1:

0695b00000luzTnAAI.png

Labels (2)
1 Solution

Accepted Solutions
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @Anh Nguyen​ 

 

You need to connect tJavaRow to an output component to be able to use "output_row".

 

It seems you want to store the absolute path for those files recently modified and read those files using tFileInputDelimited.

 

If that's the case, you can use a globaL variable instead of output_row:

 

if (TalendDate.diffDate(current_date, lastModifiedDate,"dd") <= 15) {

gobalMap.put("path", input_row.abs_path);

}

 

Then you can use this variable on your If trigger or tFileInputDelimited:

 

((String)globalMap.get("path"))

View solution in original post

2 Replies
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @Anh Nguyen​ 

 

You need to connect tJavaRow to an output component to be able to use "output_row".

 

It seems you want to store the absolute path for those files recently modified and read those files using tFileInputDelimited.

 

If that's the case, you can use a globaL variable instead of output_row:

 

if (TalendDate.diffDate(current_date, lastModifiedDate,"dd") <= 15) {

gobalMap.put("path", input_row.abs_path);

}

 

Then you can use this variable on your If trigger or tFileInputDelimited:

 

((String)globalMap.get("path"))

ANguyen1685543904
Contributor
Contributor
Author

Thank, I have found answer.