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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Create Range by condation

(0) ShareShare
ReportReport
Posted on by 58
hi 
 
how Create Range by Condation 
 
exp 
select * from Table where A<>  (B+ C)
 
how add range by SysQuery::findOrCreateRange(dataSource,fieldNum(Table ,A))?
 
thank you
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    You'll need to use expressions in query ranges.
  • XPRESS Profile Picture
    58 on at
    thank you 
    Martin Dráb 
     
    How can a condition be made between two fields like this query?
     where A <>  (B+ C)

    Thanks
  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at
    Hi XPress,
     
    I do assume you need to achieve this with x++ coding. Is this about a decimal value? You can first put the sum of the two values in a new variable. Then you can use x++ statements like the next example.
     
     
    Amount  sumBC = B + C;
    
    select * from Table where A != sumBC;
     
     
  • XPRESS Profile Picture
    58 on at
     
    q=SysQuery::findOrCreateRange(dataSource,fieldNum(Table ,A));
    q.value('A != B+C');
     
    Can the previous condition be fulfilled?
    thank you
  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at
    Hi XPress,
     
    I think to start understanding that B and C are also fields in the same table. Online calculations in queries are not supported. Like Martin shared, you can use some expressions, but no calculations. 
  • XPRESS Profile Picture
    58 on at
     
    thank you 
    Martin Dráb 
     
    My problem is that the operation of plural or subtracting two columns is not performed because it treats the two columns as a text value and not a numerical value
     

    qbr1.addRange(fieldNum(CustTable, AccountNum)).value(
    strFmt('((%1.%2 ==
    (%3 + %2))',
    qbr1.name(),
    fieldStr(CustTable, AccountNum),
    fieldStr(CustTable, CreditMax)));

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    What SQL code does it generate?
     
    Note that your code doesn't match your requirements. You wanted A != B+C, but you have A == B + A.
     
    Try prefixing all field names with %1..
     
    Another approach is creating a view with a computed column. You can do the whole calculation there and you're get a NoYes fields that is trivial to filter by.
  • XPRESS Profile Picture
    58 on at
    Thank you all
     
     
    My understanding is that the math in filtering doesn't work
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans