in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

CriteriaOperator.Parse with InOperator

Last post 12/14/2008 11:41 AM by Gary Cox. 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
Previous Next
  • 2/24/2008 5:05 PM

    CriteriaOperator.Parse with InOperator

    I'm stuck with this, and I haven't seen any examples of how to do this. Here is what I want:

     "Where Status = 'A' and Priority in (1, 2, 3, 4, 5)".

    Here is my criteria:

    CriteriaOperator co = CriteriaOperator.Parse("Status = ? AND Priority in (?)", "A", new int[ { 1, 2, 3, 4, 5 }");

    the resultant co.ToString() on this is: [Status] = 'A' And [Priority] In ('System.Int32[') instead of the expected:

    "[Status] = 'A' And [Priority] in (1, 2, 3, 4, 5)"

    Creating this criteria manually using the InOperator("Priority", new int[ {1, 2, 3, 4, 5}); does produce the correct result. It seems as though the CriteriaOperator.Parse chooses to ignore the fact that the InOperator requires an ICollection type, and just does a .ToString() on the parameter instead.

    Am I doing this wrong, or is this just impossible?

    Josh Norris

     

  • 11/18/2008 10:25 AM In reply to

    Re: CriteriaOperator.Parse with InOperator

    hi,

    do you found a solution? I have exactly the same problem.

    Dominik

  • 12/8/2008 12:38 AM In reply to

    Re: CriteriaOperator.Parse with InOperator

    Hey guys

    I have the same problem too and i'm waiting for someone to post a solution in my current post.I'll get back if ever i find a solution.

    Thanks

    No High Pressure.No Precious Diamond.
  • 12/8/2008 8:22 PM In reply to

    Re: CriteriaOperator.Parse with InOperator

    Hi guys check out this thread. http://community.devexpress.com/forums/t/71682.aspx

    thanks

    No High Pressure.No Precious Diamond.
  • 12/14/2008 11:41 AM In reply to

    Re: CriteriaOperator.Parse with InOperator

    I would recommend instead of Parse to do the following:

     

    CriteriaOperator co = new GroupOperator(GroupOperatorType.And, new BinaryOperator("Status", "A", BinaryOperatorType.Equal), new InOperator("Priority", new int[ { 1, 2, 3, 4, 5 }));

     

    Your Output will be: [Status] = 'A' And [Priority] In (1, 2, 3, 4, 5)

Page 1 of 1 (5 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED