<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Transformation - Operation Indicator - Archive User - Soft Delete in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Transformation-Operation-Indicator-Archive-User-Soft-Delete/ta-p/1969998</link>
    <description>&lt;H4 id="toc-hId--480793735"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A id="hoverCardLink" class="lia-link-navigation lia-product-hover-card-link lia-product-mention lia-tooltip-trigger" href="https://community.qlik.com/t5/c-cyjdu72974/Qlik+Replicate/pd-p/qlikReplicate" target="_blank" rel="noopener"&gt;Qlik Replicate&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Task/Table transformation&lt;/LI&gt;
&lt;LI&gt;Operation_Indicator&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;EM&gt;The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.&lt;/EM&gt;&lt;/P&gt;
&lt;H4 id="toc-hId-2005883954"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Why you may want to implement conditional soft delete on a table:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;I have seen several implementation of the Operation_Indicator function to enable "Soft Delete" on target side tables. In this example I will wrap the Operation_Indicator function with a case statement that checks the specific user that has performed the delete on the source side.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The reason for this is to allow a regular delete of a record, made by any source side user, to actually delete the record in the target and for a specific user "ArchiveUser" to turn the delete into a soft delete and just mark the record as deleted.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;With this transformation in place when an archive job is run on the source the target table will keep the records while they get deleted on the source. The scenario that this is used in is when the source side table has many months/years of old data that is going to be purged or archived. It will be deleted from the source by a monthly job run by a specific user "ArchiveUser". For business needs they do not want these archived records to be deleted from the target.&lt;/P&gt;
&lt;H4 id="toc-hId-198429491"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How the operation indicator works to achieve&amp;nbsp;the soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;We typically accomplish this through a global transformation , or a table based transformation, where we add a column to the target called Deleted_Flag - char(1) and then in the transformation we intercept the delete operation and set the added column to a 'Y'. In this way you have not physically deleted the target row, you have intercepted the delete from the source and changed it to an update on the target, and have marked it as deleted.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The general form of the function:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%" class="lia-indent-padding-left-30px"&gt;operation_indicator(value_on_delete, value_on_update, value_on_insert)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;The transformation function is Operation_indicator("Y",NULL,NULL)&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The expression for this column transformation is a task function that will basically intercept the delete from happening on the target and turn it into an update instead. As part of this update the value in the "Deleted_Flag" column is changed to "Y".&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Where to define a table level soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;Define the table level soft delete in Table Settings transform screen using the expression builder. Note the two extra columns added to the table. LoggedInUser and Deleted_Flag. First we will look at the expression for the newly added field "Delete_Flag" and then we will look at the "LoggedInUser" field and its expression.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Table Settings - Showing added field "Deleted_Flag":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_4-1660785748221.png" style="width: 738px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86956i5838331E1BC7A692/image-dimensions/738x295?v=v2" width="738" height="295" role="button" title="Michael_Litz_4-1660785748221.png" alt="Michael_Litz_4-1660785748221.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Expression Builder - Showing the expression for the soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_5-1660786044947.png" style="width: 743px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86957i36BE2D5766E599E8/image-dimensions/743x262?v=v2" width="743" height="262" role="button" title="Michael_Litz_5-1660786044947.png" alt="Michael_Litz_5-1660786044947.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Table Settings - Showing added field "LoggedInUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_4-1660785748221.png" style="width: 738px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86956i5838331E1BC7A692/image-dimensions/738x295?v=v2" width="738" height="295" role="button" title="Michael_Litz_4-1660785748221.png" alt="Michael_Litz_4-1660785748221.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Expression Builder - Showing the expression for the LoggedInUser" field:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_0-1660870209114.png" style="width: 737px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87041i00F49F35D3CADCDA/image-dimensions/737x326?v=v2" width="737" height="326" role="button" title="Michael_Litz_0-1660870209114.png" alt="Michael_Litz_0-1660870209114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Orders Table before delete operation is done on the source by the "ArchiveUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_1-1660870572813.png" style="width: 737px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87042i1FB9153E7270579C/image-dimensions/737x486?v=v2" width="737" height="486" role="button" title="Michael_Litz_1-1660870572813.png" alt="Michael_Litz_1-1660870572813.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Results after a delete operation is done on the source by the "ArchiveUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;You will see that the "Deleted_Flag" is set to "Y" and the LoggedInUser" field is set the&amp;nbsp;"ArchiveUser"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_2-1660872330296.png" style="width: 734px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87043iE1E4311223F9125D/image-dimensions/734x492?v=v2" width="734" height="492" role="button" title="Michael_Litz_2-1660872330296.png" alt="Michael_Litz_2-1660872330296.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Summary:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;The Soft Delete can be accomplished using the operation indicator function on the transformation screen.&lt;BR /&gt;In this example we only converted the deletes for a specific user "ArchiveUser"&lt;BR /&gt;In this way you have not physically deleted the target row, you have intercepted the delete from the source and changed it to an update on the target, and have marked it as deleted.&lt;/P&gt;
&lt;H3 id="toc-hId-1493643826"&gt;Related Content&lt;/H3&gt;
&lt;UL&gt;
&lt;LI class="lia-breadcrumb-node crumb final-crumb"&gt;&lt;A href="https://community.qlik.com/t5/Knowledge/Filter-Deletes-in-Replicate/ta-p/1801945" target="_self"&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-disabled="true" aria-label="Filter Deletes in Replicate"&gt;Filter Deletes in Replicate&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI class="lia-breadcrumb-node crumb final-crumb"&gt;&lt;A href="https://community.qlik.com/t5/Knowledge/How-to-implement-quot-soft-quot-deletes-on-replicated-table/ta-p/1825769" target="_self"&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-disabled="true" aria-label="Filter Deletes in Replicate"&gt;&lt;SPAN&gt;How to implement "soft" deletes on replicated table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 17:24:28 GMT</pubDate>
    <dc:creator>Michael_Litz</dc:creator>
    <dc:date>2022-08-19T17:24:28Z</dc:date>
    <item>
      <title>Transformation - Operation Indicator - Archive User - Soft Delete</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Transformation-Operation-Indicator-Archive-User-Soft-Delete/ta-p/1969998</link>
      <description>&lt;H4 id="toc-hId--480793735"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A id="hoverCardLink" class="lia-link-navigation lia-product-hover-card-link lia-product-mention lia-tooltip-trigger" href="https://community.qlik.com/t5/c-cyjdu72974/Qlik+Replicate/pd-p/qlikReplicate" target="_blank" rel="noopener"&gt;Qlik Replicate&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Task/Table transformation&lt;/LI&gt;
&lt;LI&gt;Operation_Indicator&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;EM&gt;The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.&lt;/EM&gt;&lt;/P&gt;
&lt;H4 id="toc-hId-2005883954"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Why you may want to implement conditional soft delete on a table:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;I have seen several implementation of the Operation_Indicator function to enable "Soft Delete" on target side tables. In this example I will wrap the Operation_Indicator function with a case statement that checks the specific user that has performed the delete on the source side.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The reason for this is to allow a regular delete of a record, made by any source side user, to actually delete the record in the target and for a specific user "ArchiveUser" to turn the delete into a soft delete and just mark the record as deleted.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;With this transformation in place when an archive job is run on the source the target table will keep the records while they get deleted on the source. The scenario that this is used in is when the source side table has many months/years of old data that is going to be purged or archived. It will be deleted from the source by a monthly job run by a specific user "ArchiveUser". For business needs they do not want these archived records to be deleted from the target.&lt;/P&gt;
&lt;H4 id="toc-hId-198429491"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;How the operation indicator works to achieve&amp;nbsp;the soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;We typically accomplish this through a global transformation , or a table based transformation, where we add a column to the target called Deleted_Flag - char(1) and then in the transformation we intercept the delete operation and set the added column to a 'Y'. In this way you have not physically deleted the target row, you have intercepted the delete from the source and changed it to an update on the target, and have marked it as deleted.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The general form of the function:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%" class="lia-indent-padding-left-30px"&gt;operation_indicator(value_on_delete, value_on_update, value_on_insert)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;The transformation function is Operation_indicator("Y",NULL,NULL)&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;The expression for this column transformation is a task function that will basically intercept the delete from happening on the target and turn it into an update instead. As part of this update the value in the "Deleted_Flag" column is changed to "Y".&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Where to define a table level soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;Define the table level soft delete in Table Settings transform screen using the expression builder. Note the two extra columns added to the table. LoggedInUser and Deleted_Flag. First we will look at the expression for the newly added field "Delete_Flag" and then we will look at the "LoggedInUser" field and its expression.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Table Settings - Showing added field "Deleted_Flag":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_4-1660785748221.png" style="width: 738px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86956i5838331E1BC7A692/image-dimensions/738x295?v=v2" width="738" height="295" role="button" title="Michael_Litz_4-1660785748221.png" alt="Michael_Litz_4-1660785748221.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Expression Builder - Showing the expression for the soft delete:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_5-1660786044947.png" style="width: 743px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86957i36BE2D5766E599E8/image-dimensions/743x262?v=v2" width="743" height="262" role="button" title="Michael_Litz_5-1660786044947.png" alt="Michael_Litz_5-1660786044947.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Table Settings - Showing added field "LoggedInUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_4-1660785748221.png" style="width: 738px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86956i5838331E1BC7A692/image-dimensions/738x295?v=v2" width="738" height="295" role="button" title="Michael_Litz_4-1660785748221.png" alt="Michael_Litz_4-1660785748221.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Screen Shot of the Expression Builder - Showing the expression for the LoggedInUser" field:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_0-1660870209114.png" style="width: 737px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87041i00F49F35D3CADCDA/image-dimensions/737x326?v=v2" width="737" height="326" role="button" title="Michael_Litz_0-1660870209114.png" alt="Michael_Litz_0-1660870209114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Orders Table before delete operation is done on the source by the "ArchiveUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_1-1660870572813.png" style="width: 737px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87042i1FB9153E7270579C/image-dimensions/737x486?v=v2" width="737" height="486" role="button" title="Michael_Litz_1-1660870572813.png" alt="Michael_Litz_1-1660870572813.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Results after a delete operation is done on the source by the "ArchiveUser":&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;You will see that the "Deleted_Flag" is set to "Y" and the LoggedInUser" field is set the&amp;nbsp;"ArchiveUser"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_Litz_2-1660872330296.png" style="width: 734px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/87043iE1E4311223F9125D/image-dimensions/734x492?v=v2" width="734" height="492" role="button" title="Michael_Litz_2-1660872330296.png" alt="Michael_Litz_2-1660872330296.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H4 id="toc-hId--1609024972"&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Summary:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;The Soft Delete can be accomplished using the operation indicator function on the transformation screen.&lt;BR /&gt;In this example we only converted the deletes for a specific user "ArchiveUser"&lt;BR /&gt;In this way you have not physically deleted the target row, you have intercepted the delete from the source and changed it to an update on the target, and have marked it as deleted.&lt;/P&gt;
&lt;H3 id="toc-hId-1493643826"&gt;Related Content&lt;/H3&gt;
&lt;UL&gt;
&lt;LI class="lia-breadcrumb-node crumb final-crumb"&gt;&lt;A href="https://community.qlik.com/t5/Knowledge/Filter-Deletes-in-Replicate/ta-p/1801945" target="_self"&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-disabled="true" aria-label="Filter Deletes in Replicate"&gt;Filter Deletes in Replicate&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI class="lia-breadcrumb-node crumb final-crumb"&gt;&lt;A href="https://community.qlik.com/t5/Knowledge/How-to-implement-quot-soft-quot-deletes-on-replicated-table/ta-p/1825769" target="_self"&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-disabled="true" aria-label="Filter Deletes in Replicate"&gt;&lt;SPAN&gt;How to implement "soft" deletes on replicated table&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 17:24:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Transformation-Operation-Indicator-Archive-User-Soft-Delete/ta-p/1969998</guid>
      <dc:creator>Michael_Litz</dc:creator>
      <dc:date>2022-08-19T17:24:28Z</dc:date>
    </item>
  </channel>
</rss>

