Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
talend777
Contributor
Contributor

Talend If Else Statement tMap tJavaRow

Hi all,

I have a job in which when i query the DB i get output OF 2 columns as below:

DAY_BEGIN- 20200101

DAY_END-20200102

YEAR-2020

MONTH_BEGIN- 01

MONTH_END-02

i would like to construct this statement from this DB input 

"select * from ABC where 

DAY between '20200101' and '20200102'

and YEAR = '2020' 

and MONTH between '01' and '02' ;

Basically when there are BEGIN and end in prefixes , i would like to use BETWEEN statement and pass values and when there is only single value e.g. YEAR i would like to pass = in statement.

Please recommend what would be better TMAP or TJAVAROW and the solution for java code.

 

Thank you.

 

Labels (4)
2 Replies
Shicong_Hong
Support
Support

Hi 

Sorry, I think I don't understand your question well, you want to extract the values like 20200101, 20200102 from the output of one query, and pass these value to another query? I would suggest you to use tJavaRow to hard code to parse the input rows and construct different query based on different input data, and store the query into context variable for used later on other tDBInput component.

Regards

Shicong

 

talend777
Contributor
Contributor
Author

Thank you Shicong,

Yes , i would extract the values like 20200101, 20200102 from the output of one query, and pass these value to another query.

 

I am trying to find sample code of tjavarow where

  • i can get values of 20200101, 20200102
  • truncate DAY_BEGIN, DAY_END to DAY, 
  • get values of DAY_BEGIN and DAY_END
  • form a statement DAY BETWEEN (value of DAY_BEGIN) AND (value of DAY_end)
  •