Skip to main content

Notifications

Announcements

No record found.

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
  • XPRESS Profile Picture
    XPRESS 58 on at
    Create Range by condation
    Thank you all
     
     
    My understanding is that the math in filtering doesn't work
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    Create Range by condation
    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
    XPRESS 58 on at
    Create Range by condation
     
    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)));

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Create Range by condation
    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
    XPRESS 58 on at
    Create Range by condation
     
    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
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Create Range by condation
    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
    XPRESS 58 on at
    Create Range by condation
    thank you 
    Martin Dráb 
     
    How can a condition be made between two fields like this query?
     where A <>  (B+ C)

    Thanks
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    Create Range by condation
    You'll need to use expressions in query ranges.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans