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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Print variables from inside tMap

I have a situation on the picture. How can I print out variable that was created in a tMap? Untitled.png

Labels (2)
14 Replies
Anonymous
Not applicable
Author

Yes, in the first way I showed you

Anonymous
Not applicable
Author

I mean not inside the tMap but inside tJavaRow?

Anonymous
Not applicable
Author

I am confused by this. Why do you want to print them out in the tJavaRow without passing them to the tJavaRow? What is the issue with supplying them to the tJavaRow? The reason I ask is that you will not be able to achieve this without seriously compromising the "timing" of the flow of data. If you have 100 rows being processed by the tMap, you cannot assume that when the flow gets to the tJavaRow for row 1, that the value in the Var.var1 will be valid for row 1. It may very well be processing row 100 at that point, or may have finished.

 

"Row" links and "Iterate" links work in different ways and what you are wanting would require an "Iterate" link. Unfortunately tMap components do not supply these.

 

Now, you can use some Java and extend the first solution I sent you to achieve this, but it really sounds like an awful lot of work to achieve something for a reason I cannot fathom with the information you have given. But here is the approach you could use to solve this if you do need it.....

 

1) Create a routine method similar to the one I gave, but this time load the Var variable to a HashMap with a "key" which is unique in your dataset. The HashMap should be available to the whole routine.

2) Create another routine method which will return the value of the HashMap element when supplied the correct "key"

3) In your tJavaRow call the second method (see above) and supply the "key" field. This will return the value for your Var that relates to that particular datarow.

 

As you can see, all your are really doing here is circumnavigating the normal flow in order to do something that would be easier done by simply passing the value.

 

What is the reason that it needs to be done this way?

Anonymous
Not applicable
Author

I thought this could be done easily. I thought that I saw how to do this somewhere on the internet. Thank for your reply.

Anonymous
Not applicable
Author

I think you are confusing tMap variables with globalMap variables. You get globalMap variables created when you use a tSetGlobalVar and tFlowToIterate components. globalMap values are available anywhere in the job after they have been set. However when used with a tFlowToIterate, they are only valid for the iteration following the tFlowToIterate