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!
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
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?