2 Replies Latest reply on Jun 21, 2021 10:15 PM by Jharana Patra

    Source count in a mapping

    Hemant Chadha New Member

      Hi Guys,


      I need to create a mapping that if the source has no records then the truncate to target should not happen.


      As of now we have simple Source and target mapping and I have checked the truncate target checkbox but the table gets truncated even if the mapping fails for any reason as it executes this before the mapping starts processing. Any ideas how to tackle it?




        • 1. Re: Source count in a mapping
          Nico Heinze Guru

          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.




          • 2. Re: Source count in a mapping
            Jharana Patra Guru

            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 .


            Command Task step