Four Stars

How to map global variable into insert statement (Output component)?

Hi,

 

simple task, how to map global variable into Output component? I have job, where I do synchronization and after success or failed execution, I want to insert into log table some values from global variables which I have setted in process. I tried to use tMap, but there is compilation error "var cannot be rrsolved to a variable". What is the pattern for this?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Eleven Stars

Re: How to map global variable into insert statement (Output component)?

Your problem is that your DB table is expecting a Date and you are supplying a String. You need to convert your String value to a Date. You can use this included routine/method to convert it in Talend.....

 

routines.TalendDate.parseDate(pattern, stringDate)
Rilhia Solutions
5 REPLIES
Eleven Stars TRF
Eleven Stars

Re: How to map global variable into insert statement (Output component)?

Hi,

Global variables are available using "globalMap.get" method. Here is an example for a String variable:

(String)globalMap.get("yourVariable")

 


TRF
Four Stars

Re: How to map global variable into insert statement (Output component)?

Hi,

 

that is clear, but I do not know which component can I use for this declaration. Now I am tring use tFlexFlowInput, where I have two columns one for each variable. This tFlexFlowInput is joined with Output table.

 

Current problem is Type mismatch: cannot convert from STring to date Smiley Happy

 

R.

Eleven Stars

Re: How to map global variable into insert statement (Output component)?

Your problem is that your DB table is expecting a Date and you are supplying a String. You need to convert your String value to a Date. You can use this included routine/method to convert it in Talend.....

 

routines.TalendDate.parseDate(pattern, stringDate)
Rilhia Solutions
Six Stars

Re: How to map global variable into insert statement (Output component)?

I am having the same issue, How did you generalize to get all global variable values outputted from every component. 

 

even I want to capture all those global variable values in internal audit log table.

 

for example, tFTPPut knoww what file it uploaded onto FTP, I need to fetch that last once it uploaded successfully & add that into our internal audit log table.

Four Stars

Re: How to map global variable into insert statement (Output component)?

Hi nmodi,

 

now I am using fFixedFlowInput where for each variable is set one row Column with name and in Value with (String)globalMap.get("MyStringVariable"), (Integer)globalMap.get("MyNumberVariable") or (Date)globalMap.get("MydateVariable"). The rows were created in Edit schema. And this table is mapped with Output component with Insert action on data.

 

regards,

 

Roman