<?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: Bits Concept in QV in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930061#M967723</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason QlikView stores it as -1 and 0 is that it is able to make an efficient storage into bits because it use a symbol table. So the -1 and 0 as True() and False() values are more handy than 1 or 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately due to some weird limitation in Set Expressions an expression with a set element like -1 will not work properly so if you intend to use this bit value as a flag you should either invert the value so it gets 1 and 0 also in QlikView or you need to single quote the value in a set element like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { &amp;lt; IsPromotion={'-1'} Sales ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alternatively you can do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { &amp;lt; IsPromotion={1} Sales ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { IsPromotion={-1} Sales )&amp;nbsp;&amp;nbsp;&amp;nbsp; will NOT work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your load statement you could do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -(Field1) AS Field1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Sep 2015 08:01:36 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2015-09-24T08:01:36Z</dc:date>
    <item>
      <title>Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930058#M967720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am extracting Data from SQL, In few table there are fields having Data Type In Bit and Field Value (1,0)&lt;/P&gt;&lt;P&gt;But When i am extracting Data in Qlikview than Field Value having Data Type in Bit, Getting Value (-1,0).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one suggest..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 07:52:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930058#M967720</guid>
      <dc:creator>abhaysingh</dc:creator>
      <dc:date>2015-09-24T07:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930059#M967721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True value in Qlik is -1 not 1 as usual ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 07:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930059#M967721</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2015-09-24T07:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930060#M967722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How i can Handle This...Any Suggestion?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 07:59:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930060#M967722</guid>
      <dc:creator>abhaysingh</dc:creator>
      <dc:date>2015-09-24T07:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930061#M967723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason QlikView stores it as -1 and 0 is that it is able to make an efficient storage into bits because it use a symbol table. So the -1 and 0 as True() and False() values are more handy than 1 or 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately due to some weird limitation in Set Expressions an expression with a set element like -1 will not work properly so if you intend to use this bit value as a flag you should either invert the value so it gets 1 and 0 also in QlikView or you need to single quote the value in a set element like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { &amp;lt; IsPromotion={'-1'} Sales ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alternatively you can do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { &amp;lt; IsPromotion={1} Sales ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( { IsPromotion={-1} Sales )&amp;nbsp;&amp;nbsp;&amp;nbsp; will NOT work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your load statement you could do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -(Field1) AS Field1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 08:01:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930061#M967723</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-09-24T08:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930062#M967724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need to manage in qlik as a boolean value then leave it as is, otherwise add a new field (Integer) and write 1 instead of -1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(only a simple idea ... it depends on what you need)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 08:03:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930062#M967724</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2015-09-24T08:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930063#M967725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SQLValue*(-1) as QVValue ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 08:04:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/930063#M967725</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2015-09-24T08:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006109#M1221539</link>
      <description>&lt;P&gt;I just came across this&amp;nbsp; after having a similar problem after migrating from different versions of SQL.&amp;nbsp; I do not believe this is correct.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"The reason QlikView stores it as -1 and 0 is that it is able to make an efficient storage into bits because it use a symbol table. So the -1 and 0 as True() and False() values are more handy than 1 or 0."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is dependent on the driver and not qlik. With MS SQL, I found that the SQL native client driver will load a bit field as 0/1 and the OLEDB driver will load it as 0/-1.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 20:55:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006109#M1221539</guid>
      <dc:creator>jonoogle</dc:creator>
      <dc:date>2022-11-17T20:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006450#M1221550</link>
      <description>&lt;P&gt;If Qlik stores true() / false() it stores as hinted -1 / 0. But within each calculating only the 0 is relevant because this is false() and each other value regardless if the value is -1 or 1 or even 'a' is true().&lt;/P&gt;
&lt;P&gt;This means within many scenarios the real value behind true() isn't relevant. Personally I would ensure that each stored boolean true() value is 1 - maybe forced per fabs() or ven with fabs(sign()) - because I use them often as flag-values for multiplications or to sum them.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 13:49:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006450#M1221550</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-11-18T13:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Bits Concept in QV</title>
      <link>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006550#M1221553</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for your response. The original poster had the same issue I was running into; it was not a true/false issue. He was expecting a 1/0 for a bit field and instead was getting a -1/0. This actually is not a Qlik issue, rather the driver which interprets a bit field differently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would not have used a bit field, but this was code I inherited and we ran across this in a migration. I think there are many different solutions, two of which you mentioned: if you can, use the "0" rather than the -1/1,&amp;nbsp; 2) use fabs function, 3) avoid bit fields.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 17:39:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bits-Concept-in-QV/m-p/2006550#M1221553</guid>
      <dc:creator>jonoogle</dc:creator>
      <dc:date>2022-11-18T17:39:11Z</dc:date>
    </item>
  </channel>
</rss>

