Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to take the value from tHashInput component ?

Hi,
which options we have when we want to fetch value (one db table record fetched using tMysqlInput) from tHashInput component when Talend Job is started in Java application?
I know that we can store that record in some CSV file for example using tFileOutputDelimited and parse the file later, but is there any other options how can fetch this value in Java application without writing record in the file first?
If it is possible, providing small Java snippet of fetching DB record which is stored in tHashInput would be very helpful.
Thanks,
Nenad
Labels (4)
13 Replies
Anonymous
Not applicable
Author

Hi all,
I found the way to store values from tHashInput component to globalMap object and to fetch these values in Java application.
So after tHashInput component I put tJavaRow component. In tJavaRow component I created new HashMap and inside that map I put db table record. After that I put that HashMap instance to globalMap in the same jJavaRow component.
//Instantiate metadata Map

java.util.Map<java.lang.String, java.lang.Object> docMetadata = new java.util.HashMap<java.lang.String, java.lang.Object>();


//Fetch document metadata and put it in the Map

docMetadata.put("documentID", metadata1.DocumentID);

docMetadata.put("documentName", metadata1.DocumentName);

docMetadata.put("creator", metadata1.Creator);


//Put metadata in global Map

globalMap.put("docMetadata", docMetadata);
metadata1 is connection name from tHashInput component to tJava component.
When I started job in Java application I fetched globalMap using Java reflection.
Anonymous
Not applicable
Author

Hi,
Thanks for posting that you resolved it by yourself.


Best regards
Sabrina
Anonymous
Not applicable
Author

Hi all,
I found the way to store values from tHashInput component to globalMap object and to fetch these values in Java application.
So after tHashInput component I put tJavaRow component. In tJavaRow component I created new HashMap and inside that map I put db table record. After that I put that HashMap instance to globalMap in the same jJavaRow component.
//Instantiate metadata Map

java.util.Map<java.lang.String, java.lang.Object> docMetadata = new java.util.HashMap<java.lang.String, java.lang.Object>();


//Fetch document metadata and put it in the Map

docMetadata.put("documentID", metadata1.DocumentID);

docMetadata.put("documentName", metadata1.DocumentName);

docMetadata.put("creator", metadata1.Creator);


//Put metadata in global Map

globalMap.put("docMetadata", docMetadata);
metadata1 is connection name from tHashInput component to tJava component.
When I started job in Java application I fetched globalMap using Java reflection.

could you explain step by step the procedure that you used with screenshot please? 
Anonymous
Not applicable
Author

Could you please explain with the screenshots so that it will be easy to understand.