<?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 Inserting large number of rows with Dynamic Update in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332384#M703691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My situation is as follows: &lt;/P&gt;&lt;P&gt;I have one main table with about 10-20M rows, and I need to assign these rows to (possibly overlapping) groups. To achieve this, I created a mapping table to store combinations of row keys from the main table and the group assignments. The table layout looks 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 _jivemacro_uid_13438404596537585" jivemacro_uid="_13438404596537585"&gt;&lt;P&gt;Main:&lt;/P&gt;&lt;P&gt;LOAD RowNo() as Key,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'foo' as value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate 100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mapping:&lt;/P&gt;&lt;P&gt;LOAD 0 as Key,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 as Group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate 0;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is to allow the user to select any number of rows from the Main table and to map those to a group based on a variable value.&lt;/P&gt;&lt;P&gt;In SQL, I could do that by issuing a statment like this (assuming the table MainPossible only contained the values from Main in the current selection):&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13438407108977657" jivemacro_uid="_13438407108977657"&gt;&lt;P&gt;INSERT INTO MAPPING (Key, Group) (SELECT Key, "$(Group)" as Group from MainPossible);&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried different variations to get this line running as a Dynamic Update action, but either QlikView doesn't support the nested select query or I was just unable to guess the right syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My second try was to include the values to be inserted into the SQL statement itself by using the following statement for the Dynamic Update action:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13438410213856578" jivemacro_uid="_13438410213856578"&gt;&lt;P&gt;='INSERT INTO Mapping (Key, Group) values (' &amp;amp; Concat(Key,',$(Group)), (') &amp;amp; ',$(Group))'&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution works fine for smaller numbers of rows (e.g. 4000). I need to be able to do the insert with at least 10-20M rows however, and that's not possible with the previous solution in a reasonable time (I cancelled my attempt after several minutes of waiting).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on how to solve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Aug 2012 17:23:33 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-01T17:23:33Z</dc:date>
    <item>
      <title>Inserting large number of rows with Dynamic Update</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332384#M703691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My situation is as follows: &lt;/P&gt;&lt;P&gt;I have one main table with about 10-20M rows, and I need to assign these rows to (possibly overlapping) groups. To achieve this, I created a mapping table to store combinations of row keys from the main table and the group assignments. The table layout looks 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 _jivemacro_uid_13438404596537585" jivemacro_uid="_13438404596537585"&gt;&lt;P&gt;Main:&lt;/P&gt;&lt;P&gt;LOAD RowNo() as Key,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'foo' as value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate 100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mapping:&lt;/P&gt;&lt;P&gt;LOAD 0 as Key,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 as Group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate 0;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is to allow the user to select any number of rows from the Main table and to map those to a group based on a variable value.&lt;/P&gt;&lt;P&gt;In SQL, I could do that by issuing a statment like this (assuming the table MainPossible only contained the values from Main in the current selection):&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13438407108977657" jivemacro_uid="_13438407108977657"&gt;&lt;P&gt;INSERT INTO MAPPING (Key, Group) (SELECT Key, "$(Group)" as Group from MainPossible);&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried different variations to get this line running as a Dynamic Update action, but either QlikView doesn't support the nested select query or I was just unable to guess the right syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My second try was to include the values to be inserted into the SQL statement itself by using the following statement for the Dynamic Update action:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13438410213856578" jivemacro_uid="_13438410213856578"&gt;&lt;P&gt;='INSERT INTO Mapping (Key, Group) values (' &amp;amp; Concat(Key,',$(Group)), (') &amp;amp; ',$(Group))'&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution works fine for smaller numbers of rows (e.g. 4000). I need to be able to do the insert with at least 10-20M rows however, and that's not possible with the previous solution in a reasonable time (I cancelled my attempt after several minutes of waiting).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on how to solve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 17:23:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332384#M703691</guid>
      <dc:creator />
      <dc:date>2012-08-01T17:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting large number of rows with Dynamic Update</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332385#M703692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any luck yet?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Aug 2012 22:16:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332385#M703692</guid>
      <dc:creator>alexmosq</dc:creator>
      <dc:date>2012-08-05T22:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting large number of rows with Dynamic Update</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332386#M703693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not find a way to realize the nested insert statement with Dynamic Update, but I was able to put together a resonably fast solution that uses two different insertion methods based on the amount of rows to be inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For lower numbers of rows (I picked 5000 as the limit), I used a Dynamic Update action with concatenated INSERT statements as described in my first post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For larger selections, I am exporting the selected Key values to a CSV file and append them to the Mapping table via a Partial Reload. This approach takes less than 1 1/2 minutes for 20M rows, which is sufficiently fast for my use case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2012 07:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332386#M703693</guid>
      <dc:creator />
      <dc:date>2012-08-06T07:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting large number of rows with Dynamic Update</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332387#M703695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good idea! That sounds like a reasonable approach.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2012 08:19:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-large-number-of-rows-with-Dynamic-Update/m-p/332387#M703695</guid>
      <dc:creator>alexmosq</dc:creator>
      <dc:date>2012-08-06T08:19:01Z</dc:date>
    </item>
  </channel>
</rss>

