Tommy
Tommy

Reputation: 55

How do i store the results from an db(oracle) query as a global variable to be used in a RUN-IF condition in talend?

I have a dbinput component where i am using an select statement as below:

"select file_name,file_size from dat_file where file_name = '"+(String)globalMap.get("tFileList_1_CURRENT_FILE")+"' order by file_name desc"

I want to capture the value of file_name and file_size into global variables and i can use a RUNIF condition to validate if the filename and size are same from the filelist_1 folder as in db-IGNORE

only if filename and size are different-Then continue with the rest of the PROCESSING in talend.

Btw,i am getting the file size from tfileproperties component and checking if they are the same in database and the local file folder/dir ,and only if it DIFFERS-continue processing!

My job flow looks like this: Job flow components

Upvotes: 0

Views: 1037

Answers (1)

Corentin
Corentin

Reputation: 2552

Your query is comparing FileName from tFileList with FileName from your DB. To achieve what you want, I think you should also compare FileSize in this query. Then you can check in a RUNIF condition the number of lines in your tDBInput (using global variable tDBInput_2_NB_LINE) If 0 then you don't have a match and you can continue the process

Upvotes: 1

Related Questions