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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

compare values in a list x++

(1) ShareShare
ReportReport
Posted on by 2,017
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
}
I have the same question (0)
  • Martin Dráb Profile Picture
    240,538 Most Valuable Professional on at
    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()));
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 345 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 304

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans