Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

OR condition between two ranges in ِAX query

$
0
0

I need to build a lookup query such that I need to add two rages on two different fields with OR logical condition

 

How can I do this?

 

 

 I try to use the code below but the output is AND logic not OR

 

 

    common                      ret;

    Query                       query;

    QueryBuildDataSource        QueryBuildDataSource,QueryBuildDataSource2,QueryBuildDataSource3;

    QueryBuildRange             QueryBuildRange,QueryBuildRange2;

    SysReferenceTableLookup     sysTableLookup ;

 

    query = new Query();

 

    QueryBuildDataSource = query.addDataSource(tableNum(HcmBenefit));

 

    QueryBuildDataSource2 = QueryBuildDataSource.addDataSource(tableNum(PayrollBenefitDetail));

    QueryBuildDataSource2.joinMode(JoinMode::InnerJoin);

    QueryBuildDataSource2.relations(true);

    QueryBuildRange=QueryBuildDataSource2.addRange(fieldNum(PayrollBenefitDetail, DefaultDeductionBasis));

    QueryBuildRange.value(queryValue(PayrollDeductionBasis::FixedAmount));

 

 

 

    QueryBuildDataSource3 = QueryBuildDataSource.addDataSource(tableNum(PayrollBenefitDetail));

    QueryBuildDataSource3.joinMode(JoinMode::InnerJoin);

    QueryBuildDataSource3.relations(true);

    QueryBuildRange2=QueryBuildDataSource3.addRange(fieldNum(PayrollBenefitDetail, DefaultContributionBasis));

    QueryBuildRange2.value(queryValue(PayrollContributionBasis::FixedAmount));

 

 

    sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(HcmBenefit), _formReferenceControl, true);

    sysTableLookup.addLookupfield(fieldNum(HcmBenefit, Benefitplan));

    sysTableLookup.addLookupfield(fieldNum(HcmBenefit, BenefitOption));

    sysTableLookup.parmQuery(query);

    ret = sysTableLookup.performFormLookup();

    return ret;

 


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>