One Star

Passing Connection Mode to tFTPGet tFTPPut via context or variable

I'm need to be able to set the FTP Connection mode in a context so that after a job is exported, I can change the connection mode (PASV or ACTV) without editing the job and re-exporting.
Is this possible?
I'm using TIS 4.0.3
1 REPLY
Community Manager

Re: Passing Connection Mode to tFTPGet tFTPPut via context or variable

Hi
It is impossible to set the connection mode with context variables now, it is a list type, we must select one of them at the job design time! However, there is a work around to fit the request, that is to create two different sub jobs and fires them base on a context variable, for example:
tJava--runIf--tRunJob_1
--runIf--tRunJob_2
on tJava:
if(context.connectionMode.equals("active")){
globalMap.get("active",true);
}else{
globalMap.get("active",false);
}
on the first runIf, set the condition as:
(Boolean)globalMap.get("active")
on the second runIf, set the condition as:
!(Boolean)globalMap.get("active")
in the first child job, use a tFTPConnection to create a ftp connection with 'Active mode'
in the seond child job, use a tFTPConnection to create a ftp connection with 'Passive mode'

So now, you are able to change the value of context variable and execute the job script with specified value.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business