<?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 Re: incremental load in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877826#M10061</link>
    <description>&lt;P&gt;Hi, your initial code already adds the daily data to the qvd, you can add the "where exists" option to avoid duplicated values in case some day the code is executed more than once.&lt;/P&gt;
&lt;P&gt;And yes, you always need an STORE sentence to write the data to qvd.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;STORE PriceExpertOfferAtributeDaily into [lib://Tracker (lenak)/Price/brandly.qvd](qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jan 2022 07:50:37 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2022-01-06T07:50:37Z</dc:date>
    <item>
      <title>incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877154#M10045</link>
      <description>&lt;P&gt;Hi, I have a case.&lt;/P&gt;
&lt;P&gt;the first dataset is daily data updated via api. The second table is qvd file (30-day data). And now I need to combine both tables so that the 30-day data is always overwritten by the daily data and&amp;nbsp;saved in lib: // Tracker (lenak) / Price /.&lt;/P&gt;
&lt;P&gt;The code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'Price-expert (lenak)';

RestConnectorMasterTable:

SQL SELECT

"token"

FROM JSON (wrap on) "root";

LOAD [token] AS [token]

RESIDENT RestConnectorMasterTable;

DROP TABLE RestConnectorMasterTable;

LET vAccessTokenValue = Peek('token');

trace $(vAccessTokenValue);

 
Set vTotal = 0;

Set vStartAt = 0;
Set vPageSize = 1000;

do 
  RestConnectorMasterTable:
  SQL SELECT
  "count",
  "__KEY_root",
      (SELECT
      "date",
      
      "name",
      
      "Vendor key",

      "T2 Key",

      "Series key",

      "price",

      "CPU Key",

      "GPU key",

      "SSD key",

      "RAM Key",

      "OS key",

      "Resolution key",

      "Size key",

      "Freq key",
          "__FK_data"
       FROM "data" FK "__FK_data")

  FROM JSON (wrap on) "root" PK "__KEY_root"

  WITH CONNECTION (
      URL "http://173.999.13.185/api/api-integration-v1/resource/offer-attribute-daily",
      HTTPHEADER "X-HTTP-Method-Override" "GET",
      HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)",
      QUERY "offset" "$(vStartAt)",
      QUERY "limit" "$(vPageSize)"
  );

  [PriceExpertOfferAttributeDaily]:
  LOAD
        [date],
      	
      	[name],
      
      	[Vendor key],

        [T2 Key],

        [Series key],

        [price],

        [CPU Key],

        [GPU key],

        [SSD key],

        [RAM Key],

        [OS key],

        [Resolution key],

        [Size key],

        [Freq key]
  RESIDENT RestConnectorMasterTable;

  LOAD [count] AS [total]

  RESIDENT RestConnectorMasterTable;
  DROP TABLE RestConnectorMasterTable;


  let vTotal  = Peek('total');

  trace $(vTotal);
  let vStartAt=$(vStartAt)+$(vPageSize);

Loop while vStartAt&amp;lt;vTotal;

Concatenate
LOAD
    "date",
    name,
     "Vendor key",
    "T2 Key",
    "Series key",
    price,
    "CPU Key",
    "GPU Key",
    "SSD key",
    "RAM Key",
    "OS Key",
    "Resolution key",
    "Size key",
    "Freq key"
FROM [lib://Tracker (lenak)/Price/brandly.qvd]
(qvd);&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Jan 2022 17:16:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877154#M10045</guid>
      <dc:creator>jacek27031</dc:creator>
      <dc:date>2022-01-04T17:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877319#M10049</link>
      <description>&lt;P&gt;Hi, if you want to keep only the daily data you just have to avoid the "concatenate" part.&lt;/P&gt;
&lt;P&gt;If you want to replace the date loaded in the first dataset you can add a "where not Exists()" to the second dataset:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;tmpDateLoaded:
LOAD distinct date as dateloaded resident PriceExpertOffer...;

Concatenate LOAD
...
FROM [lib://Tracker (lenak)/Price/brandly.qvd]
(qvd)
WHERE not Exists('dateloaded',date);

DROP table tmpDateLoaded;&lt;/LI-CODE&gt;
&lt;P&gt;If you want to keep the qvd with the last 30 days you can set the date on a variable and use that in the where:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LET vStartDate=Num(Today()-30);

Concatenate LOAD
...
FROM [lib://Tracker (lenak)/Price/brandly.qvd]
(qvd)
WHERE date&amp;gt;=$(vStartDate);&lt;/LI-CODE&gt;
&lt;P&gt;Do a backup of your current qvd before doing the tests so you can recover it if doesn't works at expected.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 08:26:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877319#M10049</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-01-05T08:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877326#M10051</link>
      <description>&lt;P&gt;Hi, Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;&amp;nbsp;. QVD File (brandly.qvd) should be overwritten by the daily data incrementally.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about STORE QV_Table INTO brandly.QVD file? Should not be at the end of the code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 08:40:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877326#M10051</guid>
      <dc:creator>jacek27031</dc:creator>
      <dc:date>2022-01-05T08:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877826#M10061</link>
      <description>&lt;P&gt;Hi, your initial code already adds the daily data to the qvd, you can add the "where exists" option to avoid duplicated values in case some day the code is executed more than once.&lt;/P&gt;
&lt;P&gt;And yes, you always need an STORE sentence to write the data to qvd.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;STORE PriceExpertOfferAtributeDaily into [lib://Tracker (lenak)/Price/brandly.qvd](qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 07:50:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1877826#M10061</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-01-06T07:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878178#M10069</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;,&amp;nbsp;hmm... there's some problem&lt;/P&gt;
&lt;P&gt;this is where the error occurred&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Table 'PriceExpertOfferAtributeDaily' not found&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Any idea what could be the reason?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 21:28:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878178#M10069</guid>
      <dc:creator>jacek27031</dc:creator>
      <dc:date>2022-01-06T21:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878273#M10070</link>
      <description>&lt;P&gt;Hi, add an "exit script;" before the store and check the name of tables loaded in data model at that point.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 07:04:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878273#M10070</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-01-07T07:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878495#M10071</link>
      <description>&lt;P&gt;&amp;nbsp;"Store into" function is working if I add&amp;nbsp;square brackets [&lt;SPAN&gt;PriceExpertOfferAtributeDaily]&amp;nbsp;&lt;/SPAN&gt;however, once I overwrite brandly.qvd with daily data where I have 30 days, I lose all history. On the other hand there is some mess in the tables ;/&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jacek27031_0-1641566975557.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/69809i0F4AD4DFF6FA141B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jacek27031_0-1641566975557.png" alt="jacek27031_0-1641566975557.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 14:49:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878495#M10071</guid>
      <dc:creator>jacek27031</dc:creator>
      <dc:date>2022-01-07T14:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878699#M10078</link>
      <description>&lt;P&gt;Hi, before te do...while buce initilize the table, and each iteration should add data to this table, then add the concatenate specifying wich table to concatenate:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'Price-expert (lenak)';

RestConnectorMasterTable:

SQL SELECT

"token"

FROM JSON (wrap on) "root";

LOAD [token] AS [token]

RESIDENT RestConnectorMasterTable;

DROP TABLE RestConnectorMasterTable;

LET vAccessTokenValue = Peek('token');

trace $(vAccessTokenValue);

 
Set vTotal = 0;

Set vStartAt = 0;
Set vPageSize = 1000;

// Initialize table
[PriceExpertOfferAttributeDaily]: 
NoConcatenate load * inline [dumbField];

do 
  RestConnectorMasterTable:
  SQL SELECT
  "count",
  "__KEY_root",
      (SELECT
      "date",
      
      "name",
      
      "Vendor key",

      "T2 Key",

      "Series key",

      "price",

      "CPU Key",

      "GPU key",

      "SSD key",

      "RAM Key",

      "OS key",

      "Resolution key",

      "Size key",

      "Freq key",
          "__FK_data"
       FROM "data" FK "__FK_data")

  FROM JSON (wrap on) "root" PK "__KEY_root"

  WITH CONNECTION (
      URL "http://173.999.13.185/api/api-integration-v1/resource/offer-attribute-daily",
      HTTPHEADER "X-HTTP-Method-Override" "GET",
      HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)",
      QUERY "offset" "$(vStartAt)",
      QUERY "limit" "$(vPageSize)"
  );

  // Add each pagintation to the table otuside the bucle
  Concatenate ([PriceExpertOfferAttributeDaily])
  LOAD
        [date],
      	[name],  
      	[Vendor key],
        [T2 Key],
        [Series key],
        [price],
        [CPU Key],
        [GPU key],
        [SSD key],
        [RAM Key],
        [OS key],
        [Resolution key],
        [Size key],
        [Freq key]
  RESIDENT RestConnectorMasterTable;
  
  // Set a name to this table so you can drop it and remove the messing tables
  tmpCount:
  LOAD [count] AS [total]
  RESIDENT RestConnectorMasterTable;

  DROP TABLE RestConnectorMasterTable;

  let vTotal  = Peek('total');
  DROP Table tmpCount;

  trace $(vTotal);
  let vStartAt=$(vStartAt)+$(vPageSize);

Loop while vStartAt&amp;lt;vTotal;

DROP Field dumbField;

Concatenate ([PriceExpertOfferAttributeDaily])
LOAD
    "date",
    name,
     "Vendor key",
    "T2 Key",
    "Series key",
    price,
    "CPU Key",
    "GPU Key",
    "SSD key",
    "RAM Key",
    "OS Key",
    "Resolution key",
    "Size key",
    "Freq key"
FROM [lib://Tracker (lenak)/Price/brandly.qvd]
(qvd);

STORE [PriceExpertOfferAttributeDaily] into [lib://Tracker (lenak)/Price/brandly.qvd](qvd);&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 08 Jan 2022 11:19:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878699#M10078</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-01-08T11:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: incremental load</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878990#M10081</link>
      <description>&lt;P&gt;Thank you so much &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;,&amp;nbsp;you are great! All seem to be working fine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 13:35:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/incremental-load/m-p/1878990#M10081</guid>
      <dc:creator>jacek27031</dc:creator>
      <dc:date>2022-01-10T13:35:19Z</dc:date>
    </item>
  </channel>
</rss>

