One Star

tOracleInput & dynamic parameters

Hello,
I would like to dynamically retrieve data from a db table by passing a parameter to a query.
Here's what I put in my tOracleInput component (used in a lookup for a tMap component) :
"SELECT trim(t$item), t$oltm as LT FROM ttiitm001300 WHERE t$item = " + context.partnumber + ""
I also tried
"SELECT trim(t$item), t$oltm as LT FROM ttiitm001300 WHERE t$item = " + ((String)tGlobalMap("PartNumber")) + ""
But everything is returning 'null', context.partnumber or tGlobalMap("PartNumber") although I'm initializing these values in a
preceding step (using a tJavaRow component).
globalMap.put("PartNumber", input_row.PartNumber.trim());
context.partnumber = input_row.PartNumber;
I have checked that tGlobalMap("PartNumber") contains something by creating a var in the tMap component
and outputing content in a tLog component. This data is definitely filled.
Can you explain me why the tGlobalMap entry or the context variable are empty ?
Thanks !
Stéphane
2 REPLIES
Community Manager

Re: tOracleInput & dynamic parameters

Hi
Please upload a screenshot of your job, I want to see whether you have already initialized the value before you use the context avariable or global variable.
BTW, you don't use the global variable correctly, to get the value of global variable, should be:
(String)globalMap.get("PartNumber")
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tOracleInput & dynamic parameters

Sorry, I made a typo error, I meant globalMap and not tGlobalMap.
You can see that I initialized the global map entry in a previous step.
That should work but it isn't !
Stéphane