I have a tHashedOutput that is being created triggered by an iterate link. If the iterate link is not triggered, then the tHashedOutput does not exist. I need the next subjob to execute regardless, but it fails because the hash does not exist.
I have tried initializing the hash first by having another tHashedOutput linked to the same tHashedInput, but that also fails.
Any suggestions? I think I might need to stop using tHashedOutput and create a physical file instead.
Yes, this is a pain. I wish that all tHashOutputs were initialised by default if they are in the job. However, they are not. A way to get round this is to use a tFixedFlowInput with the same schema as the tHashOutput, to initialise the tHashOuput at the beginning of the job. Then the tHashOutput you use with your iterate link needs to be linked to the tHashOutput described above. The tFixedFlowInput doesn't need to return any rows (set it to 0 rows), it just needs to run. Any tHashInput components that are meant to use the data, should be linked to the tHashOutput used to initialise.
You are right that tHashInput will be looking for data from tHashOutput and if the data is not present or if the data is flushed out, then the hash input component will fail.
If you would like to use Hash itself, then pass a dummy single row as an initial value for the hash. While retrieving, filter this dummy value out and process the rest of the items. This way, you can bypass the error.
Or, you can go by using a temp file as you have mentioned.
If the answer has helped you, could you please mark the topic as closed? Kudos are also welcome.
@nikhilthampi no problem. I often start writing a reply and find I've said the same thing as someone who hit "Post" just before I did :-)
If you initialise a tHashOutput (lets call it tHashOutput_1) at the beginning of your job then link your other tHashOutput (tHashOutput_2) to that one (in that direction), then read from tHashOutput_1 when connecting your tHashInput, it definitely works. I use this all the time.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema