Skip to Content
author's profile photo Former Member
Former Member

Conditions Object

Hi all,

As we all know we can perform operations such as co_EQUAL, co_GRATER_EQUAL,co_GRATER_THAN, co_LESS_EQUAL, co_LESS_THAN, co_NONE, and as well as co_NOT_EQUAL. Can any one help me what should i do to perform an operation similar to the following query using the Conditions object

"Select DocNum from OCRD where DocEntry IN (1,2,4)"

Thanks

John

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2004 at 12:58 PM

    In order to emulate an 'IN' with the coditions object, you will need to string together condition objects in the Conditions collection with the Relationship property set to cr_OR.

    Like this:

    (

    (Docentry CO_equal 1)

    OR

    (Docentry CO_EQUAL 2)

    OR

    (Docentry CO_EQUAL 4)

    )

    Add a comment
    10|10000 characters needed characters exceeded

    • Sorry, I think you where speaking about the GUI condition.

      private string InClause (string [] pValues,string pField)
      {
      	string Result = "(";
      	foreach (string tmpStr in pValues)
      	{
                 Result = Result + "("+pField+" CO_EQUAL "+tmpStr+") OR ";
      	}
      	return Result.Substring(0,Result.Length-4)+" )";
      }
      

      C# example which returns the In clause using multiple OR statements.

      Hope helps,

      Ibai Peñ

  • Posted on Nov 23, 2004 at 11:50 AM

    Hi John,

    The in clause works in the query generator although is not available in the conditions options. Edit the select and try this for example:

    Select DocEntry from ORDR where DocNum IN (1,2,4)

    Works fine for me.

    Regards,

    Ibai Peñ

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.