Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / compare values in a li...
Finance forum
Unanswered

compare values in a list x++

Posted on by 973
Hi,

let's say i have a sales order with 5 lines.
And let's say i have a list in my custom service that contains 3 of those lines.

i need to determine that there are two extra lines in the order and delete them, how to do that?

So i want sth like this:

While select salesLine where salesLine.SalesId = _salesId && salesLine.RecId != 'Any of the recIds in the list'
    delete this salesLine
}
  • Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    compare values in a list x++
    A better approach is using Query* classes. In your code, you can't dynamically add a range for every entry in the list, but iterating the list and calling QueryBuildDataSource.addRange() is trivial. For example:
    ListEnumerator enumerator = list.getEnumerator();
    while (enumerator.moveNext())
    {
        qbds.addRange(...).value(SysQuery::valueNot(enumerator.current()));
    }

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans