Die if file doesn't exist - multiple files but only one not exist

Six Stars

Die if file doesn't exist - multiple files but only one not exist

Hi,

 

Please advise me below problem. Thank you!  

I attached multiple files in tSendmail and have three situations when I run the job

1. one file doesn't exist but other files contains data

2. no files exist 

3. All files contain data

What I am trying to achieve is below - 

When 1st situation - I still want to send receiver email

When 2nd situation - I don't want my receiver receive any email

When 3rd situation - I want to send receiver email

For now I can't achieve above results flexibly

 

Community Manager

Re: Die if file doesn't exist - multiple files but only one not exist

Hi
Using tfileExist to check each file if they exist, parse the checking result and determine to trigger tsendMail or not using runIf connector. eg:
tfileExist1-oncomponentok-tfileExist2-oncomponentok-tfileExist3--tJava--runIf--tSendMail.

On tjava: get the checking results and parse them.
boolean file1=((Boolean)globalMap.get("tFileExist_1_EXISTS"));
boolean file2=((Boolean)globalMap.get("tFileExist_1_EXISTS"));
boolean file3=((Boolean)globalMap.get("tFileExist_1_EXISTS"));

if(file1==true||file2==true||file3==true){
globalMap.put("isContineue",true);
}else{
globalMap.put("isContinue",false);
}

set the condition of runIf as:
(Boolean)globalMap.get("isContinue")

Regards
Shong
----------------------------------------------------------
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 2

Part 2 of a series on Context Variables

Blog

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