<?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: OleDB loaded boolean value as -1 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891970#M1015358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect it is due to differences in the way the boolean type is handled by ODBC and OLEDB. ODBC treats the boolean as a bit type, which has possible values of 0 and 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps OLEDB treats it as a Boolean type, and that is then converted to a 16 or 32 bit bit integer with all the bits set to 1 for true or 0 for false - this results in a value of -1 for true. And no, I don't think you can change that without casting the boolean to another type in your SQL query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It usually doesn't matter - in Qlikview, 1 and -1 are both treated as true...&lt;/P&gt;&lt;P&gt;Fabs(...) will convert both to +1, if it matters in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Apr 2015 12:01:42 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2015-04-10T12:01:42Z</dc:date>
    <item>
      <title>OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891966#M1015354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Our existing Qlikview app uses ODBC load SQL database data. Recently we decided to change the provider to OleDB. we noticed that the Boolean value "True" is presented as -1 instead of 1 as in SQL server. Is there a way to make the true value show as 1? Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 08:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891966#M1015354</guid>
      <dc:creator />
      <dc:date>2015-04-10T08:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891967#M1015355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;TRUE is always presented as -1 in QlikView as opposed to in SQL where it's 1.&lt;/P&gt;&lt;P&gt;But you can change sign to 1 with the function fabs(). When QlikView makes a boolean test, any non-zero value will still evaluate as TRUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *, If(convertedbool,'true', 'false') as test;&lt;/P&gt;&lt;P&gt;LOAD *, fabs(bool) as convertedbool;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id, bool&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, -1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 0&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see 1 is evaluated as true&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="83335" alt="bool.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/83335_bool.png" style="font-size: 13.3333330154419px; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark as Correct answer if you are happy with the reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 10:54:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891967#M1015355</guid>
      <dc:creator>Ralf-Narfeldt</dc:creator>
      <dc:date>2015-04-10T10:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891968#M1015356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer,Ralf. My focus was slightly different. I should explain the process better.&lt;/P&gt;&lt;P&gt;I have a table in sql database with boolean field. the true value there is presented as 1.&lt;/P&gt;&lt;P&gt;I use ODBC connection load the table to Qlikview. the true value still shows as 1.&lt;/P&gt;&lt;P&gt;then I changed connection string to OleDB, reload the loaded table, the true value show as -1.&lt;/P&gt;&lt;P&gt;I was wondering if there are ways to change the representation while loading with OleDB.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 11:45:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891968#M1015356</guid>
      <dc:creator />
      <dc:date>2015-04-10T11:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891969#M1015357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it shows as 1 when you load with ODBC, is it really interpreted correctly as a boolean?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see a way to change the representation while loading with OLE DB, but you can do it in QlikView after it's loaded from the DB as I showed you if it is necessary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 11:59:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891969#M1015357</guid>
      <dc:creator>Ralf-Narfeldt</dc:creator>
      <dc:date>2015-04-10T11:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891970#M1015358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect it is due to differences in the way the boolean type is handled by ODBC and OLEDB. ODBC treats the boolean as a bit type, which has possible values of 0 and 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps OLEDB treats it as a Boolean type, and that is then converted to a 16 or 32 bit bit integer with all the bits set to 1 for true or 0 for false - this results in a value of -1 for true. And no, I don't think you can change that without casting the boolean to another type in your SQL query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It usually doesn't matter - in Qlikview, 1 and -1 are both treated as true...&lt;/P&gt;&lt;P&gt;Fabs(...) will convert both to +1, if it matters in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 12:01:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891970#M1015358</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-04-10T12:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: OleDB loaded boolean value as -1</title>
      <link>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891971#M1015359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, it is not a real issue so to speak. thanks for the clarification.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 14:13:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/OleDB-loaded-boolean-value-as-1/m-p/891971#M1015359</guid>
      <dc:creator />
      <dc:date>2015-04-10T14:13:22Z</dc:date>
    </item>
  </channel>
</rss>

