<?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 QV direct query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/QV-direct-query/m-p/1407183#M438141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;For our customer I'm using direct query to give them on demand data access.&lt;/P&gt;&lt;P&gt;In few words they get real time data at anytime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;direct discovery parameters:&lt;/P&gt;&lt;P&gt;SET DirectCacheSeconds= 300;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;LET DirectStringQuoteChar=chr(39);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;SET DirectTableBoxListThreshold= 1000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET DirectDistinctSupport='false';&lt;/P&gt;&lt;P&gt;SET DirectIdentifierQuoteStyle=’ANSI’;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;SET DirectDateFormat='YYYY-MM-DD';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET DirectUnicodeStrings = 'false';&lt;/P&gt;&lt;P&gt;SET DirectEnableSubquery = 'false';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIRECT QUERY&lt;/P&gt;&lt;P&gt;DIMENSION&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;"ORDAG2" as "sales rep code",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;"ORDNNO" as "order type"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MEASURE&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;(ORDIFT * ORDCRD * ORDCOE) as Amount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Zone:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(ATBKEY, 14, 2) as [&lt;SPAN style="font-size: 13.3333px;"&gt;sales rep code&lt;/SPAN&gt;],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(ATBUNI, 1, 20) as [Zone]&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;FROM ........&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data model is very simple with 2 tables: 1 in memory and 1 direct query.&lt;/P&gt;&lt;P&gt;i'm using a straight table with 1 dimension (Zone) e 1 measure (&lt;SPAN style="font-size: 13.3333px;"&gt;Amount&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;below an example:&lt;/P&gt;&lt;P&gt;01 - zone A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1200,00&lt;/P&gt;&lt;P&gt;02 - zone B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000,00&lt;/P&gt;&lt;P&gt;etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below Sales Amount expression:&lt;/P&gt;&lt;P&gt;Sum( aggr( if( [order type] = 'N', Sum(Amount)*-1,&lt;/P&gt;&lt;P&gt;if( [&lt;SPAN style="font-size: 13.3333px;"&gt;order type&lt;/SPAN&gt;] &amp;lt;&amp;gt; 'N', Sum(Amount) ) ), Zone, [&lt;SPAN style="font-size: 13.3333px;"&gt;order type&lt;/SPAN&gt;] ) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inside the straight table object I get real time data only the first time I make a selection, the next times I get data from the cache (for Direct Discovery query results) even if time limit ( 300 seconds = 5 minutes) is reached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While using a sample Sum(&lt;SPAN style="font-size: 13.3333px;"&gt;Amount) as straight table expression it works as expected (that is when time limit is reached Qlikview queries the source data for selections and recreates the cache for the designed time limit), but unfortunately I need to do an IF condition to perform the right calculation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;It seems you have to do a document reload to perform the query on database and to get data updated inside the straight table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Is this a bug ? or is there another way to achieve what I need ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your time in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Sep 2017 13:41:17 GMT</pubDate>
    <dc:creator>agigliotti</dc:creator>
    <dc:date>2017-09-25T13:41:17Z</dc:date>
    <item>
      <title>QV direct query</title>
      <link>https://community.qlik.com/t5/QlikView/QV-direct-query/m-p/1407183#M438141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;For our customer I'm using direct query to give them on demand data access.&lt;/P&gt;&lt;P&gt;In few words they get real time data at anytime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;direct discovery parameters:&lt;/P&gt;&lt;P&gt;SET DirectCacheSeconds= 300;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;LET DirectStringQuoteChar=chr(39);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;SET DirectTableBoxListThreshold= 1000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET DirectDistinctSupport='false';&lt;/P&gt;&lt;P&gt;SET DirectIdentifierQuoteStyle=’ANSI’;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;SET DirectDateFormat='YYYY-MM-DD';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SET DirectUnicodeStrings = 'false';&lt;/P&gt;&lt;P&gt;SET DirectEnableSubquery = 'false';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIRECT QUERY&lt;/P&gt;&lt;P&gt;DIMENSION&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;"ORDAG2" as "sales rep code",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;"ORDNNO" as "order type"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MEASURE&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;(ORDIFT * ORDCRD * ORDCOE) as Amount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Zone:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(ATBKEY, 14, 2) as [&lt;SPAN style="font-size: 13.3333px;"&gt;sales rep code&lt;/SPAN&gt;],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(ATBUNI, 1, 20) as [Zone]&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;FROM ........&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data model is very simple with 2 tables: 1 in memory and 1 direct query.&lt;/P&gt;&lt;P&gt;i'm using a straight table with 1 dimension (Zone) e 1 measure (&lt;SPAN style="font-size: 13.3333px;"&gt;Amount&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;below an example:&lt;/P&gt;&lt;P&gt;01 - zone A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1200,00&lt;/P&gt;&lt;P&gt;02 - zone B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000,00&lt;/P&gt;&lt;P&gt;etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below Sales Amount expression:&lt;/P&gt;&lt;P&gt;Sum( aggr( if( [order type] = 'N', Sum(Amount)*-1,&lt;/P&gt;&lt;P&gt;if( [&lt;SPAN style="font-size: 13.3333px;"&gt;order type&lt;/SPAN&gt;] &amp;lt;&amp;gt; 'N', Sum(Amount) ) ), Zone, [&lt;SPAN style="font-size: 13.3333px;"&gt;order type&lt;/SPAN&gt;] ) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inside the straight table object I get real time data only the first time I make a selection, the next times I get data from the cache (for Direct Discovery query results) even if time limit ( 300 seconds = 5 minutes) is reached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While using a sample Sum(&lt;SPAN style="font-size: 13.3333px;"&gt;Amount) as straight table expression it works as expected (that is when time limit is reached Qlikview queries the source data for selections and recreates the cache for the designed time limit), but unfortunately I need to do an IF condition to perform the right calculation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;It seems you have to do a document reload to perform the query on database and to get data updated inside the straight table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Is this a bug ? or is there another way to achieve what I need ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your time in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Sep 2017 13:41:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QV-direct-query/m-p/1407183#M438141</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2017-09-25T13:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: QV direct query</title>
      <link>https://community.qlik.com/t5/QlikView/QV-direct-query/m-p/1407184#M438142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that was because DIMENSIONS are kept in memory.&lt;/P&gt;&lt;P&gt;I solved using a sample aggregation of the measure, as Sum(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;Amount), else I should do a document reload to see data updated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2017 09:26:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QV-direct-query/m-p/1407184#M438142</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2017-09-27T09:26:45Z</dc:date>
    </item>
  </channel>
</rss>

