Five Stars ami
Five Stars

tFILEEXIST

Dear Users,
I want to implement the file exist in the dir or no after archival process is over ,
i made the following job:-


Configuration of each component is as follows:-
tfilelist:-


tfileexist:-

if condition:
2nd if condition if file dosent exist:-


Its throwing null pointer exception in tfileexist, any idea please help
thanks.
7 REPLIES
Community Manager

Re: tFILEEXIST

Hi 
What is the full error message? Can you please upload a screenshot of the whole job?
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: tFILEEXIST

Hi 
What is the full error message? Can you please upload a screenshot of the whole job?
Regards
Shong

Dear shong,
Below is the screen shot of full job:-

Error message:-
Starting job FILE_EXIST at 20:56 06/01/2017.
connecting to socket on port 3726
connected
: sapphire_611.file_exist_0_1.FILE_EXIST - tFileExist_1 null
Exception in component tFileExist_1
java.lang.NullPointerException
at sapphire_611.file_exist_0_1.FILE_EXIST.tFileList_1Process(FILE_EXIST.java:588)
at sapphire_611.file_exist_0_1.FILE_EXIST.runJobInTOS(FILE_EXIST.java:1129)
at sapphire_611.file_exist_0_1.FILE_EXIST.main(FILE_EXIST.java:963)
disconnected
Job FILE_EXIST ended at 20:56 06/01/2017.
Community Manager

Re: tFILEEXIST

I think I have replied you in another topic, this is because you don't use the right global variable, please check it. 
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: tFILEEXIST

I think I have replied you in another topic, this is because you don't use the right global variable, please check it. 

Dear Shong,
I used the right global variable as said by u
((Boolean)globalMap.get("tFileExists"))
and 
!((Boolean)globalMap.get("tFileExists"))
But i am getting error in tFileexist component
error:null pointer exception

I have used the global variable in tfileexist as 
((String)globalMap.get(tFileList_1_CURRENT_FILEPATH))
Community Manager

Re: tFILEEXIST

I used the right global variable as said by u
((Boolean)globalMap.get("tFileExists"))
and 
!((Boolean)globalMap.get("tFileExists"))

Are you sure you input the correct expression? To me, the error is caused by the global variable that does not exist.
The correct expression is:
((Boolean)globalMap.get("tFileExist_1_EXISTS"))
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars ami
Five Stars

Re: tFILEEXIST

I used the right global variable as said by u
((Boolean)globalMap.get("tFileExists"))
and 
!((Boolean)globalMap.get("tFileExists"))

Are you sure you input the correct expression? To me, the error is caused by the global variable that does not exist.
The correct expression is:
((Boolean)globalMap.get("tFileExist_1_EXISTS"))
Regards
Shongif 

Dear Shong,
You are right , there was error in the global variable , i am able to run now .
Now what is happening i am able to check if file is present it says file exist.
But when file is not there it doesn't display file dose not exist.
tfilelist doesn't return anything may be thats why it doesn't display file doesn't exist.
How to handle this?
Community Manager

Re: tFILEEXIST

Hi  
I don't understand your job logic, tfilelist is used to iterate each file that matches the file mark, and you use the current file path on tFileExist to check if the file exist? The result of tFileExist should be always true in your case. 
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business