One Star

tGlobalVar --> tOracleSP

Hello,
My problem is:
I have more tOracleSP in a job. with the same input parameter.
I set these parameters as global variables in the tGlobalVar.
In tOracleSP, I use the values of these variables as follows:
((String) globalMap.get ("var_GV")). ToString ()).
After testing, these variables take the expected values.
The tOracleSP can not run the stored procedure with these variables.
But when I use a tfixedFloxInput to pass variables to tOracleSP, it works well. but I have to use the following syntax:
row.var_tffi.
The objective of tGlobalvar is to use global variables in all the job.
Thank you for your help.
9 REPLIES
Employee

Re: tGlobalVar --> tOracleSP

Hi,
Please, could you attach the screenshot of the job please.
Best regards,
GAT
Employee

Re: tGlobalVar --> tOracleSP

You can clic on "post reply" and add a screenshot.
Community Manager

Re: tGlobalVar --> tOracleSP

Hi
You have to use a input component like tFixedFlowInput to pass the variables as input parameters to tOracleSP component if the SP requires input parameters, the job looks like:
tFileInputDelimited--main--tGlobalVar
|
onsubjobok
|
tFixedFlowInput--main--tOracleSP--tLogRow
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tGlobalVar --> tOracleSP

I can not add the screenshot. here's an example of a part of my job.
tFixedFloxInput1--->main--->tGlobalVar--->tOracleSP1
|
OnsubjobOK
|
tFixedFloxInput2--->main--->tOracleSP2_____onComponentOK____tFixedFloxInput3--->main--->tOracleSP3
|
tFixedFloxInput4--->main--->tOracleSP4_____onComponentOK____tFixedFloxInput5--->main--->tOracleSP5
.
.
.
I already use the solution proposed by Shong, but I think there are better in Talend.
Thank you
Employee

Re: tGlobalVar --> tOracleSP

Hi,
You are not able to load the screenshot because of its size or dimension.
But not to bad your description allows me to give you my opinion.
You have omitted the important part of the job. I think, you have link tSetGlobalVar to tOracleSP with the row main link.
You must be aware that, in a subjob, the begin parts of each component is initialized in reverse order and after the main parts after and the end one
begin of all components in reverse order
|
|
v
main of all components of the subjob
|
|
v
end of all component

so the begin part of tOracleSP component will be initialized before the main part of the tSetGlobalVar component (this component has only main part)
in which the global variable is set.
So for tFixedFloxInput1--->main--->tGlobalVar--->tOracleSP1 you nedd to use in tOracleSP1
row_name.col_name to set parameter
and only in the subjob (for the others tOracleSP2, ...), you can use the ((String)globalMap.get("myKey"))
Best regards,
GAT
One Star

Re: tGlobalVar --> tOracleSP

Hi GAT,
I could not give more details about my job. but everything you said is already in place.
Here is an overview of the details with a single variable:
tFixedFloxInput1--->main--->tGlobalVar----->main------->tOracleSP1
var_tffi1---------------------->var_GV1=var_tffi1-----------> var_tOSP =row.var_tffi1
|
OnsubjobOK
|
tFixedFloxInput2 ---------->main----->tOracleSP2 ______onComponentOK____tFixedFloxInput3------------------>main------------------>tOracleSP3
var_tffi2=((String)globalMap.get("var_GV1"))---------------------->row.var_tffi2________________________var_tffi3=((String)globalMap.get("var_GV1"))---------->row.var_tffi3
|
OnsubjobOK
|
tFixedFloxInput4 --------->main--------->tOracleSP4 ______onComponentOK____tFixedFloxInput5--------------->main-------------------->tOracleSP5
var_tffi4=((String)globalMap.get("var_GV1"))-------------------------->row.var_tffi4________________________var_tffi5=((String)globalMap.get("var_GV1"))------------->row.var_tffi5

.
.
.
However , I will wish to make is that in all tOraclePS put the value of the global variable in tOracleSP2
example : var_tOSP2 = ((String) globalMap.get ("var_GV1"))
Thank you
Employee

Re: tGlobalVar --> tOracleSP

After the first subjob, you can test that the contains of your variable is correct :
with tJava component before use the variable.
tFixedFloxInput1--->main--->tGlobalVar----->main------->tOracleSP1
var_tffi1---------------------->var_GV1=var_tffi1-----------> var_tOSP =row.var_tffi1
|
OnsubjobOK
|
tJava : System.out.println(((String)globalMap.get("var_GV1")))

Regards,
GAT
One Star

Re: tGlobalVar --> tOracleSP

I have already done this test, the variables return the expected values.
when I use the syntax to retrieve the value of global variable, it gets null.
Thus, in the tOracleSP, I create a varaible var_tOSP = ((string) globalMap.get (var_GV)). After execution: var_tOSP = NULL.
but if: var_tOSP = row.var_tffi, After execution: var_tOSP = value
One Star

Re: tGlobalVar --> tOracleSP

the screenshot