Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Romanesku
Contributor III
Contributor III

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.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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)

View solution in original post

5 Replies
TRF
Champion II
Champion II

Hi,

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

(String)globalMap.get("yourVariable")

 

Romanesku
Contributor III
Contributor III
Author

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 0683p000009MACn.png

 

R.

Anonymous
Not applicable

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)
nmodi
Creator
Creator

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.

Romanesku
Contributor III
Contributor III
Author

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