tFileExist not working?

Six Stars

tFileExist not working?

hi,

I am doing my first Talend course and I am in the process of trying to understand the functionality of the components. I the course, a tFileExist component is used to activate a subjob if a given file exists. Seems straightforward to me, but I can not get it working myself.

 

It seems that no matter what, the tFileExist component always fires the onSubJobOK action as well as the OnComponentOK action.

 

To check this, I have created a new job with a simplified version of the course lesson, only containing a tFileExist compent and two tMsgBox components. I linked the tMsgBox components using OnSubjobOK and OnSubjobError, with different messages. In the tFileExist compoment I specified a non existing file. But the OK message is always displayed, if the specified file exists or not.

My goal is trying to understand this component, trying to understand why it is not working right now, and the proper way to do a file test.

 

I am using Talend studio 6.5.1 on a linux machine right now. If I need to clarify, please let me know.

Thanks in advance,

 

Ruud


Accepted Solutions
Six Stars

Re: tFileExist not working?

I have attached a screenshot of the job. It is really very simple. I managed to get a working version by connection the two tMsgBox components with a 'run if' connector and respectively condidtions

(Boolean)globalMap.get("tFileExist_1_EXISTS")

and

! (Boolean)globalMap.get("tFileExist_1_EXISTS") 

but I cannot understand why the tFileExist component does not do this itself.

 

On the talend site, I found a tutorial that indicates that tFileExist should_work as I presumed: https://help.talend.com/reader/g8zdjVE7fWNUh3u4ztO6Dw/ziyLfSTQ51rpK6WIDGOkgQ

 

Is this sufficient to describe my configuration?

thanks, Ruud


All Replies
Forteen Stars TRF
Forteen Stars

Re: tFileExist not working?

Share your job design with settings for tFileExists and the "if" triggers you wrote.


TRF
Six Stars

Re: tFileExist not working?

I have attached a screenshot of the job. It is really very simple. I managed to get a working version by connection the two tMsgBox components with a 'run if' connector and respectively condidtions

(Boolean)globalMap.get("tFileExist_1_EXISTS")

and

! (Boolean)globalMap.get("tFileExist_1_EXISTS") 

but I cannot understand why the tFileExist component does not do this itself.

 

On the talend site, I found a tutorial that indicates that tFileExist should_work as I presumed: https://help.talend.com/reader/g8zdjVE7fWNUh3u4ztO6Dw/ziyLfSTQ51rpK6WIDGOkgQ

 

Is this sufficient to describe my configuration?

thanks, Ruud

Forteen Stars TRF
Forteen Stars

Re: tFileExist not working?

tFileExists give you the answer, the file exists or not.

So you have to test the tFileExist_1_EXISTS using an "If" trigger to decide where to go.

That's the way it works.

 


TRF
Eight Stars

Re: tFileExist not working?

Hi,

 

You need to use "Run if" trigger to know whether the file exist or not. In this way we will check the file exist validation. Attaching the screen shot for your reference.

 

 

Thanks,

Bharath.

Six Stars

Re: tFileExist not working?

I guess so. But the name suggests the component is there to do a file check. Why this has to be done explicitly again is a bit confusing to a novice like me.

Moreover, the tutorials and course material I found up til now advice to use the onSubJobOK connection. That is confusing too.

Hopefully talend proves to be intuitive again when I continue my course Smiley Wink

 

 

Ruud

Forteen Stars TRF
Forteen Stars

Re: tFileExist not working?

onComponentOK means the component doesn't failed, and it doesn't even if the file doesn't exists, right.

onComponentError means the component failed, but maybe the file exists...

So it's logic to have to check the dedicated variable associated to the component giving the answer to the question "does this file exists or not".


TRF
Six Stars

Re: tFileExist not working?

I see. But then, maybe the tFileExist component should better be renamed to tCondition, because it can contain any test even not file related tests? Thanks for the help anyway; I can now stop trying to implement onComponentOK based solution.
Forteen Stars TRF
Forteen Stars

Re: tFileExist not working?

Not at all.

tFileExists does just 1 thing, testing a file exists or not.

Then it's your responsability to decide what to do after and how to use the variable proposed by the component.

 

Don't forget to mark your case as solved (Kudo also accepted).


TRF
Forteen Stars TRF
Forteen Stars

Re: tFileExist not working?

@rgros thank's to mark your case as solved (Kudos also accepted).


TRF
Six Stars

Re: tFileExist not working?

OK, if you don't mind, I mark my own reply as solution, because it is most detailed.
The essence of the tFileExist component is that it sets the global variable which can then be testen. Right. I missed that detail.
Still I think it is wise to update the reference manual (see link) on that point....
Ruud