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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
ndy_Benoit
Contributor
Contributor

reusing a tHashOutput after a 'clear cache after reading' checked

Hello,
I'm using tHash components in my job.
here is a part of this program :
 tHashInput1 -> tHashOutput2
parameters of the component tHashInput1 :  linked with component tHashOutput_1 and clear cache after reading is checked
is it possible to initialize later in the program the component tHashOutput_1, in order to reuse it in a loop ?
I have try that : tFixedFlowInput -> tHashOutput1
When I run the program, I have an error on this component tHashOutput1 "Exception in component tHashOutput_xx java.lang.NullPointerException ..."
With the tFixedFlowInput parameter  Number of rows=0 or Number of rows=1,  it doens't work.
Labels (3)
10 Replies
ndy_Benoit
Contributor
Contributor
Author

oups, 😕 due to a pb with my browser, I have posted 4 times the same post. Sorry
ndy_Benoit
Contributor
Contributor
Author

Hello,
no answer ? (even with multiple posts ... )
ndy_Benoit
Contributor
Contributor
Author

I have found that Przemgk in the post "Problem with tHash in tLoop" had tried AdvancedMemoryHashFile object.
Is it a good way ?
it's very important for me.
I'm waiting your ideas.
Anonymous
Not applicable

It's quite difficult to understand what you want to do I'm afraid. Do you have a job layout you can post? Why are you wanting to loop, empty your hash and refill it? Can you give an example? 
ndy_Benoit
Contributor
Contributor
Author

Thank you for your answer,
here  is a part the job.
The aim of this jobs is to join data from a file with "Opened Alarm" with another file  "Closed Alarm".
In order to improve speed, I have put each file, Closed alarm and Open Alarm in a tHash component, respectively in "mem_fic_lu" and "mem_alarme_ouverte".
Each closed alarm are picked up, one by one, and compared to the opened alarms.
So, I have a loop begining with a tFlowToIterate_1
I put "mem_alarme_ouverte" (Clear cache after reading is checked) in a temporary memory "tmp_mem_alarme_ouverte".


Then, I try to reinitialize mem_alarme_ouverte, because I need to fill it later if I don't find the closed alarm searched in the memory "tmp_mem_alarme_ouverte"
 
So, I'm reading the memory "tmp_mem_alarme_ouverte" and compare it to the closed alarm searched.
If I found it, I save the values in a file.
If not found, I save the open alarm readen in the memory mem_alarm_ouverte (and put the closed alarm search in a file too).

After that, I go back to tFlowIterate_1 ....
 

A I have done this job, I need to reuse the memory, if it's possible.
I hope it's a bit clearer.
Ben
ndy_Benoit
Contributor
Contributor
Author

I don't seen my screenshots !!!
0683p000009MDFa.jpg
0683p000009MDJW.jpg
0683p000009MDJb.jpg 

0683p000009MD4U.jpg
ndy_Benoit
Contributor
Contributor
Author

Hello,
is there a way to reset tHash component after "Clearing cache after reading" ?
I need to reuse this memory in a loop.
When I put data again, after clearing cache, I have this execution error : "Exception in component tHashOutput_12 java.lang.NullPointerException" :
 
(I hope the quality of the screenshot will be good ...)
  0683p000009MDJg.jpg
Anonymous
Not applicable

If you are wanting reuse the tHash component simply for looping purposes without adding to the dataset, you could put the subjob inside the loop in a child job. Every time the loop iterates, the child job would be fired and the tHash component would be re-initialised. This should get round your problem of trying to use the tHash again after it has been cleared down. 
ndy_Benoit
Contributor
Contributor
Author

In the loop, the tHash memory should have rows which number depends on the equality or not between opened and closed alarms.
I need to use each new version of the memory, after the loop.
So I can't call a child job if I can't bring back to the main job this memory.
 What about using the class AdvancedMemoryHashFile as I have seen it in another post ?