Four Stars

Dynamically pass value dynamically in trestquest with tmysqlinput

i have facing problem in to get  data from database using trestrequest , txmlmap and tmysqlinput. my question is i m passing value in url like {doctorName} and that value which i have passing in url and it search in tmysqinput using of  like   please Find attachment 

 

This is SQL

 

"SELECT
`doctor_details`.`id`,
`doctor_details`.`doctorName`
FROM `doctor_details` where `doctor_details`.`doctorName` Like  " + globalMap.get("request.doctorName")

24 REPLIES
Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

"SELECT
`doctor_details`.`id`,
`doctor_details`.`doctorName`
FROM `doctor_details` where `doctor_details`.`doctorName` Like '% " + globalMap.get("request.doctorName") +"%'"

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

not work sill not search  

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

try the query into a MySQL editor first.

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

mysql editor working find and retrieve the relatively data.

 

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

not working to dynamically to passing that parameter

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

does it work without request.doctorName parameter?

Francois Denis

Don't forget to tag when it's "solved"!

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

can you send a screenshot of your job?

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

PFA for my job screen sort

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

ok in your tmap:
for row1 click the tool.
in lookup Model select reload at each row.
in the new exp. line
click on +
add request.doctorName
in your sql query use globalMap.get("myKey")

is it Fine?

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

but i have want txmlmap to extract their data not tmap

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

can u give the screen short

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

txmlMap or tMap it's the same you have to use dynamic lookup.

I cannot add pics but you can havea look to:

https://help.talend.com/reader/g8zdjVE7fWNUh3u4ztO6Dw/Ll_zYlcDgWNvb7kwSypEQQ

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

still not work please find Attachment 

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

you forget this

 

"lookup Model" select "reload at each row"

add doctor name as globalmap key.

Sans titre1.png

 

 

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

this noting return 

 

{"root": 

     {"g": 

         {

           "doctorName": ""

         }

     }

} 

 

also PFA 

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

you have to remove the second purple arrow who make a full match between request.doctorName and row1.doctorName

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

i have try also but come same output that means nothing came

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

page7.png

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

same response not data will show 

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

remove where close
"SELECT id, doctorName FROM doctor_details"
or try with
"SELECT id, '" + globalMap.get("request.doctorName") +"' FROM doctor_details"

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

it working fine but i have different one i need where clause to used of 'like' 

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

yes you need the where clause.
first sql is to check that MySQL return things and the end of the job is ok.
the second one is to check globalMap values
do they are ok?
check query result with like clause and globalMap values
does it work in my sql editor?

Francois Denis

Don't forget to tag when it's "solved"!

Four Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

i have check in mysql work branch to write SQL Query in it return data with where clause and like method if i remove that where clause in talend then why used globalMap.get() to retrieve simple map then it got that data

Ten Stars

Re: Dynamically pass value dynamically in trestquest with tmysqlinput

you are not in an inner join or in an outer join . you are looking for a partial math (using like '%xxxxxx%').
the match is done by sql like clause so you have to generate one SQL query by row.


if doctor name is a key roll back remove the like clause, remove reload for each row and make full match(case sensitive).

Francois Denis

Don't forget to tag when it's "solved"!