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?

huangapple go评论76阅读模式
英文:

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!

英文:

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:
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?

答案1

得分: 1

你的查询正在将tFileList中的FileName与数据库中的FileName进行比较。为了实现你的目标,我认为你还应该在这个查询中比较FileSize。然后,你可以在一个RUNIF条件中检查tDBInput中的行数(使用全局变量tDBInput_2_NB_LINE)。如果为0,则表示没有匹配,你可以继续进行进程。

英文:

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

huangapple
  • 本文由 发表于 2020年10月7日 14:47:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/64238647.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定