Split the mapping into two.
The first one only sources the records and should produce an output record only if the number of source records is > 0. This dummy record could be written to a "nowhere" target.
Make sure that the second mapping is executed only if the first one did deliver one output record.
The second mapping is the one with the Truncate Target Table option.
Hi Hemant ,
its working as a presession command and hence truncate is happening prior processing the records to the target .
To achieve the above design a advanced taskflow and in the decision step f the source count is zero then end the task else use command task (use script to execute delete command) post calling the MCT in the success path.
This should help .