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

One Star

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.
One Star

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

oups, :-/ due to a pb with my browser, I have posted 4 times the same post. Sorry
One Star

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

Hello,
no answer ? (even with multiple posts ... )
One Star

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

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.
Sixteen Stars

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

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? 
One Star

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

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
One Star

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

I don't seen my screenshots !!!


 

One Star

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

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 ...)
 
Sixteen Stars

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

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. 
One Star

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

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 ?
Sixteen Stars

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

You can send data back to the main job using the tBufferOutput and import data into the child job using context variables or one of the data input components.
You can use Java to make this easier (if you are happy with Java). Store you data in an ArrayList or HashMap using tJavaFlex. I have written a tutorial on something completely unrelated which covers this. It might help. https://www.rilhia.com/tutorials/load-xml-files-batches-records
One Star

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

Thank you very much for these informations.
Even it's a bit hard for me , I will try to use java code as you describe it on your tuto.