web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

QueryBuildDataSource AddRange with or condition

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I'm trying to filter this:

need to get the ' % of commission' field or 'justification for not commission' field

But my result is comming with AND condicion... 

I did the following:

Query           querySalesLine;

QueryBuildDataSource qbds

;

qbds = qbds.addDataSource(tablenum(HistoryControlGrouped));

qbds.addLink(fieldnum(SalesLine, RecId), fieldnum(HistoryControlGrouped, RecIdSource));
qbds.addRange(fieldnum(HistoryControlGrouped, commission)).value("3");
qbds.addRange(fieldnum(HistoryControlGrouped, CommissionPercentage)).value(">0");

But the result is:

SELECT FIRSTFAST * FROM SAG_HistoryControlGrouped WHERE SalesLine.RecId = SAG_HistoryControlGrouped.RecIdSource AND ((Comissao = 3)) AND ((SAG_CommissionPercentage>0.E0))

How can I change the AND to OR?

Thanks!!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Look at Expressions in query ranges. It's ugly and error-prone code, but it works.

  • Peter Kou Profile Picture
    5 on at

    Ok, Thanks Martin!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans