<?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>topic How Can I Delete Data *After* LOADing? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289217#M707830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Try using INNER JOIN &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Dec 2011 21:48:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-12-08T21:48:32Z</dc:date>
    <item>
      <title>How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289216#M707829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a fairly complicated script which loads a set of fact tables, then loads multiple copies of a dates table, renaming fields such that the key field in each Dates table maps to a field in the fact tables.&amp;nbsp; E.g., if my fact table has and order date and a ship date, I get two copies of Dates, Order Dates and Ship Dates, and the date key field is renamed to %OrderDateKey and %ShipDateKey, respectively (mad props to Witherspoon for most of the code).&amp;nbsp; This works, however I get every date in each copy of the dates table.&amp;nbsp; I'd like to delete records from each of the Dates tables if there are no matches to the fact table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I was simply joining table A to table B, I'd use the INNER keyword, easy as that.&amp;nbsp; Unfortunately this is not an option due to the complexity of the process for loading and relabeling the dates data.&amp;nbsp; Ideally I'd run something like "DELETE FROM [Order date] WHERE %OrderKey IS NULL", however based on &lt;A _jive_internal="true" href="https://community.qlik.com/community.qlik.com/ideas/2050"&gt;what I've seen&lt;/A&gt;, this does not seem to be an option.&amp;nbsp; An equivalent action in the GUI would be to select %OrderKey (or some other field which has a value for every record in the fact tables) and then use Reduce Data | Keep Possible Values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that's unclear, here's a simplified outline:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fact Table&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 50%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;%OrderKey&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;%OrderDateKey&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;2011/09/01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;234&lt;/TD&gt;&lt;TD&gt;2011/11/01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;TD&gt;2011/12/01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order Dates Table&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 50%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;%OrderDateKey&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Year and quarter&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011/09/01&lt;/TD&gt;&lt;TD&gt;2011.Q3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011/10/01&lt;/TD&gt;&lt;TD&gt;2011.Q4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011/11/01&lt;/TD&gt;&lt;TD&gt;2011.Q4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011/12/01&lt;/TD&gt;&lt;TD&gt;2011.Q4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2012/01/01&lt;/TD&gt;&lt;TD&gt;2012.Q1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A List Based on Order Date Looks Like This&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 50%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Year and quarter&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011.Q3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2011.Q4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2012.Q1 - a future date; very confusing for &lt;EM&gt;order&lt;/EM&gt; date&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to discard the last record from the Order Dates table, as there are no orders with an order date in 2012.&amp;nbsp; I don't really have a preference as to whether or not the date 2011/10/01, which also has no orders but is not a future date, stays or goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read the doc pages on KEEP and EXISTS(), but they seem to be limited to modifying the LOAD command, and do not let you discard data after loading.&amp;nbsp; Am I missing a command which would achive this?&amp;nbsp; Something like "DELETE FROM [Order Dates] WHERE Date &amp;gt; Today()" would work, but only if I could apply it after the load, to specific tables, as some date tables &lt;EM&gt;should&lt;/EM&gt; include future dates (e.g., expiration date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 21:33:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289216#M707829</guid>
      <dc:creator />
      <dc:date>2011-12-08T21:33:56Z</dc:date>
    </item>
    <item>
      <title>How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289217#M707830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Try using INNER JOIN &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 21:48:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289217#M707830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-08T21:48:32Z</dc:date>
    </item>
    <item>
      <title>How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289218#M707831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, as mentioned in the second paragraph, I could use that if I was simply joining one table to another.&amp;nbsp; However, I am building the second table in the script, and must rename its fields before the correct join logic exists, so the deletion has to happen after the load.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 21:52:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289218#M707831</guid>
      <dc:creator />
      <dc:date>2011-12-08T21:52:07Z</dc:date>
    </item>
    <item>
      <title>How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289219#M707832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this will do it ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpTableA:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Noconcatenate Load * from TableA where {condition...};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP TABLE TableA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RENAME TABLE tmpTableA to TableA;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 22:19:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289219#M707832</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2011-12-08T22:19:41Z</dc:date>
    </item>
    <item>
      <title>How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289220#M707833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try filtering using where condition like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;WHERE OrderKey &amp;lt;=Today();&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderKey, YearQuarter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011/09/01,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011.Q3&lt;/P&gt;&lt;P&gt;2011/10/01,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011.Q4&lt;/P&gt;&lt;P&gt;2011/11/01,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011.Q4&lt;/P&gt;&lt;P&gt;2011/12/01,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011.Q4&lt;/P&gt;&lt;P&gt;2012/01/01,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012.Q1&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 06:15:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289220#M707833</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2011-12-09T06:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289221#M707834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A KEEP should do what you want. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEFT KEEP([Fact Table]) LOAD %OrderDateKey RESIDENT [Order Dates Table];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KEEP doesn't join tables. It only reconciles the two tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 09:21:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289221#M707834</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-12-09T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289222#M707835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a number of ways to filter data &lt;EM&gt;while&lt;/EM&gt; loading.&amp;nbsp; What I need to do is discard data that has already been loaded, because the filter will not apply until I've renamed fields, which I am doing &lt;EM&gt;after&lt;/EM&gt; the table has been loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think Flipside's suggestion is close.&amp;nbsp; I believe you need the RESIDENT keyword, in this situation, since the goal is to clone a table in memory rather than load one from a file.&amp;nbsp; What I haven't worked out is a WHERE clause that specifies "the value in field X must appear in field Y in table Z."&amp;nbsp; This is what I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;// Load the fact table, including the fields %OrderDateKey and %ShipDateKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Load the dates table as [Order dates], renaming the PK field to %OrderDateKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a new list of order dates which only incldues those that actually have orders:&lt;/P&gt;&lt;P&gt;[Order dates (trimmed)]:&lt;/P&gt;&lt;P&gt;NOCONCATENATE LOAD * RESIDENT [Order dates] WHERE EXISTS (%OrderDateKey);&lt;/P&gt;&lt;P&gt;DROP TABLE [Order dates];&amp;nbsp; // Discard the old table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Load the dates table again, this time as [Ship dates], renaming the PK field to %ShipDateKey, and trim it as done with [Order dates]&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the EXISTS does not do what I need for this problem, as all date key values &lt;EM&gt;do&lt;/EM&gt; exist, in [Order dates].&amp;nbsp; So what I'd like to do is something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;NOCONCATENATE LOAD * RESIDENT [Order dates] WHERE EXISTS (%OrderDateKey IN Orders);&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a compromise, I could use "WHERE Date(SQLDate) &amp;lt;= Now()".&amp;nbsp; This would limit the dates table to past dates, but it would leave in any dates upon which no orders were placed.&amp;nbsp; This could be good or bad, but at least it's simple, easily explained to the consumers.&amp;nbsp; Using this workaround, I could more simply include the filter when loading the dates table each time, and would not need to LOAD RESIDENT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 17:56:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289222#M707835</guid>
      <dc:creator />
      <dc:date>2011-12-09T17:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289223#M707836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are overlooking the easy solution with KEEP. After your tables have been loaded, renamed, etc, the complete code to then remove the extra dates is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Order Dates Table2]:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LEFT KEEP([Fact Table]) LOAD * RESIDENT [Order Dates Table];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DROP TABLE [Order Dates Table];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I misunderstanding the requirement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 01:59:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289223#M707836</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-12-10T01:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Delete Data *After* LOADing?</title>
      <link>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289224#M707837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My impression was that KEEP would not work, because it can only be used while loading the data for the first time.&amp;nbsp; After all, if I LOAD X from X.qvd, and then KEEP LOAD X2 from RESIDENT X, every record in X2 will be kept, because every record in X2 has a matching record in X.&amp;nbsp; It has to, since it's a clone of X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, your sample code suggests that you can specify a second table, presumably meaning "keep all records in X where there's a natural match to Y."&amp;nbsp; That would certainly change things.&amp;nbsp; And it works!&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I'll stop bothering with checking the QlikView built-in help, it leaves out so much it's less than useless.&amp;nbsp; The doc page on Keep doesn't mention this capability, or give any code examples.&amp;nbsp; It &lt;EM&gt;is&lt;/EM&gt; described under the "Left" page, which is hardly the keyword I'd use to look up how to delete records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 15:26:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-Can-I-Delete-Data-After-LOADing/m-p/289224#M707837</guid>
      <dc:creator />
      <dc:date>2011-12-12T15:26:52Z</dc:date>
    </item>
  </channel>
</rss>

