<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Multiple Where clause</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Multiple Where clause</description>
  <pubDate>Thu, 16 Apr 2026 07:30:34 -700</pubDate>
  <lastBuildDate>Fri, 17 Feb 2012 00:56:41 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3264</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Multiple Where clause : i wonder how it works in your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12690#12690</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1381" rel="nofollow">k_cire0426</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 17-Feb-2012 at 12:56am<br /><br />i wonder how it works in your end...I am checking the script on profiler and it definitely not grouping.. i'll find what's causing this...&nbsp;]]>
   </description>
   <pubDate>Fri, 17 Feb 2012 00:56:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12690#12690</guid>
  </item> 
  <item>
   <title>Multiple Where clause : The following works when I tested...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12687#12687</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 16-Feb-2012 at 7:24pm<br /><br />The following works when I tested it.<div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>&#091;TestMethod&#093;</div><div>&nbsp; &nbsp; public void DynamicQueryCombiningPredicates() {</div><div>&nbsp; &nbsp; &nbsp; //T11526</div><div>&nbsp; &nbsp; &nbsp; var pd1 = new PredicateDescription("UnitPrice", FilterOperator.IsGreaterThanOrEqualTo, 24);</div><div>&nbsp; &nbsp; &nbsp; var pd2 = new PredicateDescription("Discontinued", FilterOperator.IsEqualTo, true);</div><div>&nbsp; &nbsp; &nbsp; var pd3 = new PredicateDescription("Category.Name", FilterOperator.StartsWith, "P");</div><div>&nbsp; &nbsp; &nbsp; var arrPredicates = new ArrayList { pd1, pd2, pd3 };</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; CompositePredicateDescription compPredicates = null;</div><div>&nbsp; &nbsp; &nbsp; IPredicateDescription predicate = null;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; for (int arrCount = 0; arrCount &lt; arrPredicates.Count; arrCount++) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if (predicate != null) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (compPredicates == null) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compPredicates = predicate.And((IPredicateDescription)arrPredicates&#091;arrCount&#093;);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //tried this as well</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //compPredicates = (predicate.And((IPredicateDescription)arrPredicates&#091;arrCount&#093;));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //here is the part where i add the parenthesis, but i tried the above as well...</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compPredicates = (compPredicates).Or((IPredicateDescription)arrPredicates&#091;arrCount&#093;);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; } else {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; predicate = (IPredicateDescription)arrPredicates&#091;arrCount&#093;;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; var r1 = _em1.Products.Where(p =&gt; (p.UnitPrice &gt;= 24 &amp;&amp; p.Discontinued) || p.Category.Name.StartsWith("P")).ToList();</div><div>&nbsp; &nbsp; &nbsp; var r2 = _em1.Products.Where(compPredicates).ToList();</div><div>&nbsp; &nbsp; &nbsp; Assert.IsTrue(r1.Count == r2.Count);</div><div>&nbsp; &nbsp; }</div></div><div></pre></td></tr></table></div><div><br></div><div>I had to change</div><div><br></div><div>arrCount &lt;= arrPredicates.Count</div><div><br></div><div>to&nbsp;</div><div><br></div><div>arrCount &lt; arrPredicates.Count&nbsp;</div><div><br></div><div>or else it throws index out of range exception.</div>]]>
   </description>
   <pubDate>Thu, 16 Feb 2012 19:24:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12687#12687</guid>
  </item> 
  <item>
   <title>Multiple Where clause : hello denisK,	Here is the sample...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12686#12686</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1381" rel="nofollow">k_cire0426</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 16-Feb-2012 at 4:44pm<br /><br />hello denisK,<div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>Here is the sample code.&nbsp;</div><div><span style=": white; "><br></span></div><div><span style=": white; "><span ="Apple-tab-span" style="white-space:pre">	</span>The code below assuming that we have 3 predicates and the 1 and 2 predicate will be in group.</span></div><div><br></div><div><span style=": white; font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; color: rgb43, 145, 175; ">CompositePredicateDescription</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;compPredicates&nbsp;=&nbsp;</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; color: blue; ">null</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; ">;</span></div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; -: initial initial; -repeat: initial initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#2b91af;">IPredicateDescription</span>&nbsp;predicate&nbsp;=&nbsp;<span style="color:blue;">null</span>; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">for</span>&nbsp;(<span style="color:blue;">int</span>&nbsp;arrCount&nbsp;=&nbsp;0;&nbsp;arrCount&nbsp;&lt;=&nbsp;arrPredicates.Count;&nbsp;arrCount++)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">if</span>&nbsp;(predicate&nbsp;!=&nbsp;<span style="color:blue;">null</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">if</span>&nbsp;(compPredicates&nbsp;==&nbsp;<span style="color:blue;">null</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compPredicates&nbsp;=&nbsp;predicate.And((<span style="color:#2b91af;">IPredicateDescription</span>)arrPredicates&#091;arrCount&#093;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:green;">//tried&nbsp;this&nbsp;as&nbsp;well</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:green;">//compPredicates&nbsp;=&nbsp;(predicate.And((IPredicateDescription)arrPredicates&#091;arrCount&#093;));</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">else</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</pre><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; -: initial initial; -repeat: initial initial; "><span ="Apple-tab-span" style="white-space:pre">			</span><pre style=": white; font-family: C&#111;nsolas; -: initial; -attachment: initial; -origin: initial; -clip: initial; "><span style="color: green; "><span ="Apple-tab-span" style="white-space:pre">			</span>//here is the part where i add the parenthesis, but i tried the above as well...</span></pre><pre style=": white; font-family: C&#111;nsolas; -: initial; -attachment: initial; -origin: initial; -clip: initial; "><span style=": white; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compPredicates&nbsp;=&nbsp;(compPredicates).Or((</span><span style=": white; color: rgb43, 145, 175; ">IPredicateDescription</span><span style=": white; ">)arrPredicates&#091;arrCount&#093;);</span></pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">else</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;predicate&nbsp;=&nbsp;(<span style="color:#2b91af;">IPredicateDescription</span>)arrPredicates&#091;arrCount&#093;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</pre><pre style="-: initial; -attachment: initial; -origin: initial; -clip: initial; : white; "></pre>]]>
   </description>
   <pubDate>Thu, 16 Feb 2012 16:44:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12686#12686</guid>
  </item> 
  <item>
   <title>Multiple Where clause : Would you be able to post a code...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12682#12682</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 16-Feb-2012 at 11:01am<br /><br />Would you be able to post a code snippet?]]>
   </description>
   <pubDate>Thu, 16 Feb 2012 11:01:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12682#12682</guid>
  </item> 
  <item>
   <title>Multiple Where clause : hello denisK, :)	Your sample is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12674#12674</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1381" rel="nofollow">k_cire0426</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 15-Feb-2012 at 9:34pm<br /><br />hello denisK, :)<div><br></div><div><span ="Apple-tab-span" style="white-space: pre; ">	</span>Your sample is working, however it seems not working when combining each predicatedescription in a for loop one by one. I have all my PredicateDescription in the ArrayList..</div><div><br></div><div>thanks...</div>]]>
   </description>
   <pubDate>Wed, 15 Feb 2012 21:34:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12674#12674</guid>
  </item> 
  <item>
   <title>Multiple Where clause : Hi k_cire0426,Here&amp;#039;s an example. ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12665#12665</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 14-Feb-2012 at 6:42pm<br /><br />Hi k_cire0426,<div><br></div><div>Here's an example.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>&nbsp; &nbsp; &nbsp; var pd1 = new PredicateDescription("AccountID", FilterOperator.IsEqualTo, "123");</div><div>&nbsp; &nbsp; &nbsp; var pd2 = new PredicateDescription("Group", FilterOperator.IsEqualTo, "Group1");</div><div>&nbsp; &nbsp; &nbsp; var pd3 = new PredicateDescription("AccountID&nbsp;", FilterOperator.IsEqualTo, "1234");</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; var pd = (pd1.And(pd2)).Or(pd3);</div></div><div></pre></td></tr></table></div>]]>
   </description>
   <pubDate>Tue, 14 Feb 2012 18:42:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12665#12665</guid>
  </item> 
  <item>
   <title>Multiple Where clause : Hello,	How do I convert this SQL...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12659#12659</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1381" rel="nofollow">k_cire0426</a><br /><strong>Subject:</strong> 3264<br /><strong>Posted:</strong> 13-Feb-2012 at 9:14pm<br /><br />Hello,<div><br></div><div><span ="Apple-tab-span" style="white-space: pre; ">	</span>How do I convert this SQL Where Expression to&nbsp;<b>CompositePredicateDescription</b>?</div><div><br></div><div><span ="Apple-tab-span" style="white-space: pre; ">	</span><b>WHERE (AccountID = '123' AND Group = 'Group1')&nbsp;</b></div><div><b><span ="Apple-tab-span" style="white-space: pre; ">			</span>OR AccountID = '1234'</b></div><div><b><br></b></div><div>thanks</div>]]>
   </description>
   <pubDate>Mon, 13 Feb 2012 21:14:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3264&amp;PID=12659#12659</guid>
  </item> 
 </channel>
</rss>