in

CodeSmith Community

Your Code. Your Way. Faster!

DataSources, ApplyFilter, and an OR statement

Last post 01-22-2007 8:36 PM by Robert Hinojosa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-18-2007 10:00 PM

    DataSources, ApplyFilter, and an OR statement

    Hi All,

    Sorry if this post is a repeat, normally I would ask google first but search for the phrase OR just seems like a bad idea.

    Can someone please clarify for me how to us an OR condition in a filter on a DataSource?

    As far as I can tell, the expression is being parsed correctly in Expressions.SplitFilter, but when it comes to Filter.ApplyFilter the OR statement does not seem to be taken into account.

    Have I seriously miss-read something here?

    Thanks

    Nick

     

     

    Filed under: ,
    • Post Points: 45
  • 01-22-2007 8:36 PM In reply to

    Re: DataSources, ApplyFilter, and an OR statement

    Hi,

    You can try these options:
    Option 1:
    ChannelParameterBuilder filter = new ChannelParameterBuilder(false, false);

    filter.AppendEquals(ChannelColumn.IdChannel, "1");
    filter.AppendEquals(ChannelColumn.IdChannel, "2");

    Option 2:
    ChannelParameterBuilder filter = new ChannelParameterBuilder();
    filter.AppendIn(ChannelColumn.IdChannel, "1,2");


    Option 3:

     ChannelParameterBuilder filter = new ChannelParameterBuilder(false, false);
    filter.AppendEquals(ChannelColumn.IdChannel, "1");
    filter.Junction = "OR";

    filter.AppendEquals(ChannelColumn.IdChannel, "2");

     


    Execute filter:
    TList<Channel> list = DataRepository.ChannelProvider.Find(filter.GetParameters());




    Robert Hinojosa

    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams

    http://www.nettiers.com
    -------------------------------------
    • Post Points: 5
Page 1 of 1 (2 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems