tFTPRename - Set "Filemask" and "New name" fields dynamically
I have a job that should do the following: 1) connect to a FTP server (tFTPConnection) 2) using tFTPFileList, look for files in a specific directory 3) for each file found, with tFTPRename, rename the file using the following algorithm: i) split the file name into the main file name and the extension (e.g., myfile.dat => "myfile" + ".dat" ii) generate a string that is a date/time stamp in the format YYYYMMDD_hhmiss (e.g., "02202012_112800") iii) join all three parts into a new file name (e.g., myfile_02202012_112800.dat) 4) the file is to be moved into a different directory The process I have created seems really convoluted, but it works EXCEPT that I can't figure out how to rename/move the file by setting the "Filemask" and "New name" properties on tFTPFileRename dynamically (passed in via the tLogRow). Could someone help me, please? I have attached all of the relevant screenshots. Thanks!
This is what I get when I run the job: Starting job Emdeon_Claims_Data_Loading at 12:16 20/02/2012. connecting to socket on port 3425 connected Exception in component tFTPRename_1 java.lang.NullPointerException at test.emdeon_claims_data_loading_0_1.Emdeon_Claims_Data_Loading.tIterateToFlow_1_AIProcess(Emdeon_Claims_Data_Loading.java:3599) at test.emdeon_claims_data_loading_0_1.Emdeon_Claims_Data_Loading.tFTPFileList_1Process(Emdeon_Claims_Data_Loading.java:763) at test.emdeon_claims_data_loading_0_1.Emdeon_Claims_Data_Loading.tFTPConnection_2Process(Emdeon_Claims_Data_Loading.java:383) at test.emdeon_claims_data_loading_0_1.Emdeon_Claims_Data_Loading.runJobInTOS(Emdeon_Claims_Data_Loading.java:4046) at test.emdeon_claims_data_loading_0_1.Emdeon_Claims_Data_Loading.main(Emdeon_Claims_Data_Loading.java:3914) disconnected Job Emdeon_Claims_Data_Loading ended at 12:16 20/02/2012.
Re: tFTPRename - Set "Filemask" and "New name" fields dynamically
Hi The reason you got NPE is that you typed row6.Column in tFTPRename. The values of ROW6 will be null, if you put "Row->Main" between tLogRow and tFTPRename. You'd better save values into context variables by tJavaRow instead of tMap. One more thing. If you want to move files into a new directory. You have to use tFTPGet and tFTPPut as a subjob. Regards, Pedro