<?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: Exists in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1586843#M739629</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response. As suggested,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used two separate tables:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data:&lt;BR /&gt;load * inline [&lt;BR /&gt;Name1,age&lt;BR /&gt;Bill,46&lt;BR /&gt;John,9&lt;BR /&gt;Funny,5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;load *,&lt;BR /&gt;exists(Name1,'Bill') as BillFlag&lt;BR /&gt;Resident Data&lt;BR /&gt;;&lt;BR /&gt;drop table Data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then result is like: (All BillFlag value became -1 now?)&lt;/P&gt;&lt;P&gt;Name1&amp;nbsp; &amp;nbsp;Age&amp;nbsp; &amp;nbsp;BillFlag&lt;/P&gt;&lt;P&gt;Bill&amp;nbsp; &amp;nbsp; &amp;nbsp;46&amp;nbsp; &amp;nbsp; -1&lt;/P&gt;&lt;P&gt;John&amp;nbsp; &amp;nbsp;9&amp;nbsp; &amp;nbsp;-1&lt;/P&gt;&lt;P&gt;Funny&amp;nbsp; &amp;nbsp;5&amp;nbsp; -1&lt;/P&gt;</description>
    <pubDate>Thu, 30 May 2019 19:39:01 GMT</pubDate>
    <dc:creator>SteveZheng</dc:creator>
    <dc:date>2019-05-30T19:39:01Z</dc:date>
    <item>
      <title>Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1586664#M739627</link>
      <description>&lt;P&gt;In definition, exists is defined as below:&lt;/P&gt;&lt;TABLE cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="Code"&gt;Exists(Employee, 'Bill')&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns -1 (True) if the field value&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="statement"&gt;'Bill'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is found in the current content of the field&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="statement"&gt;Employee&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;The statements&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Code"&gt;Exists (Employee, Employee)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Code"&gt;Exists (Employee)&lt;/SPAN&gt;are equivalent.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I use this following script to verify, it will give me 0 value as True, why? Thanks!&lt;/P&gt;&lt;P&gt;load *,&lt;BR /&gt;exists(Name1,'Bill') as BillFlag;&lt;/P&gt;&lt;P&gt;load * inline [&lt;BR /&gt;Name1,age&lt;BR /&gt;Bill,46&lt;BR /&gt;John,9&lt;BR /&gt;Funny,5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;result:&lt;/P&gt;&lt;P&gt;Name1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;age&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BillFlag&lt;/P&gt;&lt;P&gt;Bill&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;46&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;John&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -1&lt;/P&gt;&lt;P&gt;Funny&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exists/m-p/1586664#M739627</guid>
      <dc:creator>SteveZheng</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1586698#M739628</link>
      <description>&lt;P&gt;You are using exists() in a preceding load.&amp;nbsp; The first time you test for 'Bill', 'Bill' has not actually been written out to Name1.&lt;/P&gt;&lt;P&gt;This would work as expected if you did this as two tables, that is with a resident load.&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;load * inline [&lt;BR /&gt;Name1,age&lt;BR /&gt;Bill,46&lt;BR /&gt;John,9&lt;BR /&gt;Funny,5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;load *,&lt;BR /&gt;exists(Name1,'Bill') as BillFlag&lt;BR /&gt;Resident Data&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 14:21:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exists/m-p/1586698#M739628</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2019-05-30T14:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1586843#M739629</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response. As suggested,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used two separate tables:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data:&lt;BR /&gt;load * inline [&lt;BR /&gt;Name1,age&lt;BR /&gt;Bill,46&lt;BR /&gt;John,9&lt;BR /&gt;Funny,5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;load *,&lt;BR /&gt;exists(Name1,'Bill') as BillFlag&lt;BR /&gt;Resident Data&lt;BR /&gt;;&lt;BR /&gt;drop table Data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then result is like: (All BillFlag value became -1 now?)&lt;/P&gt;&lt;P&gt;Name1&amp;nbsp; &amp;nbsp;Age&amp;nbsp; &amp;nbsp;BillFlag&lt;/P&gt;&lt;P&gt;Bill&amp;nbsp; &amp;nbsp; &amp;nbsp;46&amp;nbsp; &amp;nbsp; -1&lt;/P&gt;&lt;P&gt;John&amp;nbsp; &amp;nbsp;9&amp;nbsp; &amp;nbsp;-1&lt;/P&gt;&lt;P&gt;Funny&amp;nbsp; &amp;nbsp;5&amp;nbsp; -1&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 19:39:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exists/m-p/1586843#M739629</guid>
      <dc:creator>SteveZheng</dc:creator>
      <dc:date>2019-05-30T19:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1586944#M739632</link>
      <description>&lt;P&gt;That would be the expected result.&amp;nbsp; Every row is testing for the value 'Bill' in the field Name1, which would always be true.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not a very useful example, but I suppose it illustrates the function working.&amp;nbsp; A more realistic use of Exists() would be:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Orders:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; OrderId, CustomerId, ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FROM Orders...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Customers:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD CustomerId, CustomerName, ..&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FROM Customers...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Where Exists (CustomerId, CustomerID)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;That would test each CustomerId as we load it against all previously loaded values of CustomerId, ensuring that we only loaded Customers that exist in Orders.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 22:44:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exists/m-p/1586944#M739632</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2019-05-30T22:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Exists/m-p/1587717#M739635</link>
      <description>Thanks a lot for the explanation!&lt;BR /&gt;Steve</description>
      <pubDate>Mon, 03 Jun 2019 15:11:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Exists/m-p/1587717#M739635</guid>
      <dc:creator>SteveZheng</dc:creator>
      <dc:date>2019-06-03T15:11:11Z</dc:date>
    </item>
  </channel>
</rss>

