Deleting from a tHashOutput

One Star

Deleting from a tHashOutput

I have some data in a tHashOutput component. Based on some conditions, i would like to delete some records from this set. Whats the best way of going about this ?
Presently, using a tMap i am populating a new tHashOutput component that contains the records from the first tHashOutput minus the records to be deleted. This works fine in a simple job, but when i have to repeatedly delete from a tHashOutput (say in a loop), this approach does not seem to work as everytime the source data set will be the same.
For eg. My set (tHashOutput_1) contains 10 records - A,B,C,D,E,F,G,H,I,J
In the first loop, i have to delete D and E. So using the above logic, i transfer the remaning records to a new tHashOutput_2. (tHashOutput_1 remains the same)
In the second loop, record A is to be deleted, now in this case , since tHashOutput_1 is the same, tHashOutput_2 will now contain B,C,D,E,F,G,H,I,J.(D and E appear again since the logic in the second iteration does not consider D and E to be present).
This behaviour would repeat throughout the loop.
Any suggestions ?
Thanks!
Employee

Re: Deleting from a tHashOutput

You cannot "delete" records as such from the tHash components. What you can do is empty them once they have been read and then write to them again in a loop scenario. To empty the recordset once it has been read all you need to do is tick the "Clear cache after reading" tick box
One Star

Re: Deleting from a tHashOutput

If i do that, then i get a nullpointerexception when trying to load it with data again.
Employee

Re: Deleting from a tHashOutput

Are you sure you are getting the NullPointerException when trying to write to the hash or when you are trying to read from it? The error stack would be useful with a screenshot of your job. Doing this in a loop is going to be tricky to work through without being there. Is there any reason why you are using the tHash components to do this instead of using a database to hold these values? 
One Star

Re: Deleting from a tHashOutput

Hello,
I have the same issue when I try to load my tHash memory again, after "Clearing cache after reading".
What can I do ?