Use OR operator to filter 2 columns with the same value?

nxbangnxbang Member Posts: 11
edited 2006-08-30 in Dynamics AX
Hi all,
I have a situation is adding 2 ranges to the QueryBuildDataSource to filter 2 difference columns with the same value, similar to the query string as below:

select tableName where column1 == "A" || columns == "A";

Could you show me how to implement that by Query, QueryBuildDataSoure object, please?

Thanks.
______________________________________
Dont think flowers is droped when the spring pass

Comments

  • s0843s0843 Member Posts: 4
    nxbang wrote:

    Could you show me how to implement that by Query, QueryBuildDataSoure object, please?

    Thanks.

    The first question is: do you know how to build such query using QueryBuildDataSource etc. ?

    If you do, so I can tell you some hint. You can use a string which be a queryExpression. You can put there a phrase of SQL and put it do your query as queryvalye. An example is in Address form in addQuerySmmQuotationTable method :)

    If you still don't know how to do this, please let me know, I'll try to do some ready-to use example :wink:
    I have a question
  • nxbangnxbang Member Posts: 11
    Dear s0843,
    I already finished that one. Thank you anyway...
    s0843 wrote:
    The first question is: do you know how to build such query using QueryBuildDataSource etc. ?

    If you do, so I can tell you some hint. You can use a string which be a queryExpression. You can put there a phrase of SQL and put it do your query as queryvalye. An example is in Address form in addQuerySmmQuotationTable method :)

    If you still don't know how to do this, please let me know, I'll try to do some ready-to use example :wink:
    ______________________________________
    Dont think flowers is droped when the spring pass
  • chackoThomaschackoThomas Member Posts: 2
    Hello!
    You can try this following code in a Job:-

    SalesTable SalesTable;
    Query Q;
    QueryRun QR;
    Str QueryString;
    ;
    QueryString = '(CustAccount="4010") || (InvoiceAccount ="4010")';
    Q = new Query();
    //In addrange() you can add any fields from SalesTable
    Q.addDataSource(Tablenum(SalesTable)).addRange(Fieldnum(SalesTable,CustAccount)).value(QueryString);

    QR = new QueryRun(Q);
    while(QR.next())
    {
    SalesTable = QR.getNo(1);
    Print SalesTable.SalesId;
    Pause;
    }

    Regards,
    Chacko Thomas
  • MugurMugur Member Posts: 93
    You may also consider this article - it describes extessivelly query range problem in Axapta http://www.axaptapedia.com/index.php/Ex ... ery_ranges
    Kind regards,

    Ciprian Dudau
    Axapta Developer
Sign In or Register to comment.