<?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: Where and and statements not working as expected in Data Movement &amp; Streaming</title>
    <link>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494189#M2848</link>
    <description>&lt;P&gt;Hi! &lt;BR /&gt;It seems the issue you’re encountering likely stems from how AND and OR are being interpreted in the WHERE clause in Qlik's load script. In Qlik, AND and OR have specific precedence rules that might not align with what you expect.&lt;/P&gt;
&lt;P&gt;Your current script:&lt;BR /&gt;WHERE Match([Baseline Status], 'Timely')&lt;BR /&gt;AND Match([Project Officer], 'Persons Name')&lt;BR /&gt;OR Match([Project Officer], 'Persons Name')&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;is interpreted like this due to operator precedence:&lt;/P&gt;
&lt;P&gt;WHERE (Match([Baseline Status], 'Timely') AND Match([Project Officer], 'Persons Name'))&lt;BR /&gt;OR Match([Project Officer], 'Persons Name')&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This means that any record matching the Project Officer condition (regardless of Baseline Status) will be included.&lt;/P&gt;
&lt;P&gt;To solve you need to explicitly define the precedence using parentheses. For example, if you intend to apply the Timely condition to both Project Officer matches, structure it like this:&lt;/P&gt;
&lt;P&gt;WHERE Match([Baseline Status], 'Timely')&lt;BR /&gt;AND (Match([Project Officer], 'Persons Name') OR Match([Project Officer], 'Another Persons Name'&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2024 14:46:49 GMT</pubDate>
    <dc:creator>diegozecchini</dc:creator>
    <dc:date>2024-11-22T14:46:49Z</dc:date>
    <item>
      <title>Where and and statements not working as expected</title>
      <link>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494188#M2847</link>
      <description>&lt;P&gt;I have a fairly simple load script, but I am having a weird issue. I am using a WHERE statement and an AND statement like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WHERE Match([Baseline Status],'Timely')
    AND Match([Project Officer],'Persons Name')
   OR Match([Project Officer],'Persons Name')&lt;/LI-CODE&gt;
&lt;P&gt;If I only use the first project officer (PO), I get only records that match Timely If I use my OR statement then I get all records (Timely, Past End Date, etc.). I searched the interwebs and can't figure out why this is happening. Hopefully this is just some silly thing I overlooked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 21:46:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494188#M2847</guid>
      <dc:creator>bruce_sorge</dc:creator>
      <dc:date>2025-03-19T21:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Where and and statements not working as expected</title>
      <link>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494189#M2848</link>
      <description>&lt;P&gt;Hi! &lt;BR /&gt;It seems the issue you’re encountering likely stems from how AND and OR are being interpreted in the WHERE clause in Qlik's load script. In Qlik, AND and OR have specific precedence rules that might not align with what you expect.&lt;/P&gt;
&lt;P&gt;Your current script:&lt;BR /&gt;WHERE Match([Baseline Status], 'Timely')&lt;BR /&gt;AND Match([Project Officer], 'Persons Name')&lt;BR /&gt;OR Match([Project Officer], 'Persons Name')&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;is interpreted like this due to operator precedence:&lt;/P&gt;
&lt;P&gt;WHERE (Match([Baseline Status], 'Timely') AND Match([Project Officer], 'Persons Name'))&lt;BR /&gt;OR Match([Project Officer], 'Persons Name')&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This means that any record matching the Project Officer condition (regardless of Baseline Status) will be included.&lt;/P&gt;
&lt;P&gt;To solve you need to explicitly define the precedence using parentheses. For example, if you intend to apply the Timely condition to both Project Officer matches, structure it like this:&lt;/P&gt;
&lt;P&gt;WHERE Match([Baseline Status], 'Timely')&lt;BR /&gt;AND (Match([Project Officer], 'Persons Name') OR Match([Project Officer], 'Another Persons Name'&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 14:46:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494189#M2848</guid>
      <dc:creator>diegozecchini</dc:creator>
      <dc:date>2024-11-22T14:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Where and and statements not working as expected</title>
      <link>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494195#M2849</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/82758"&gt;@diegozecchini&lt;/a&gt;,&amp;nbsp;this was the issue. As I suspected, something simple.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 14:54:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Movement-Streaming/Where-and-and-statements-not-working-as-expected/m-p/2494195#M2849</guid>
      <dc:creator>bruce_sorge</dc:creator>
      <dc:date>2024-11-22T14:54:38Z</dc:date>
    </item>
  </channel>
</rss>

