More in this section

Forums / Developing with Sitefinity / OR Filterexpression does not work

OR Filterexpression does not work

2 posts, 0 answered
  1. Christian
    Christian avatar
    20 posts
    12 Mar 2008
    02 Oct 2009
    Link to this post

    we simple try to set a Filterexpression with an OR Join:

    Metadata1 = true OR Metadata2 = true

    This doesn´t work.

    If we use the filter sperate / single Metadata1 = true

    the filter gets executed.

    Could you help us to find the way to go to use an OR FIlterexpression?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    02 Oct 2009
    Link to this post
    Hello Christian,

    "OR" condition is not supported by Nolics and cannot be used. We will support OR condition from 4.0 where we are going to use Open Access ORM.

    There is not elegant way filter the items using the API and achieve similar behavior as "OR" condition. However below are some steps ( note that this will result in the performance of the control and your website - this way requires several foreach and if loops).

    1. Create a custom class that derives from ContentView class.
    2. Override CreateDataSource method used to retrieve content items from the data store.
    3.  Use intersection to apply "OR" filtering. You should create a two list of items - list1 and lit 2. Then for each item in list1 you should have two conditions - which checks whether the item ID exists or not in the fists list.

    I hope this helps.

    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered