Skip to main content

Notifications

Microsoft Dynamics AX forum
Answered

A Problem with creating the query x++

Posted on by 2,016

Greeting everyone 

by using while select i'm really confused to how create a query by x++ for my request?

i have this table 

plans.JPG

i have tow request from this table i don't know get it by x++ select 

1-i need employees which have only (Plan==PlanA &&  Status==Open) must this employees doesn't have another different row

and the result should be 
(Katey , Ben) 

others will be ignored because they have more than this satiation Plan and Status

2-i need employees which have only (Plan==PlanB &&  Status== Close )must this employees doesn't have another different row

and the result should be 
(Sara) 

others will be ignored because they have more than this satiation Plan and Status

i really try many select but all gone wrong how can i do that also i did used group by but still not give me the result which i need?

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: A Problem with creating the query x++

    Record record;

    Record notExistsRecord;

    -- first case

    select record 

    where record.Plan=='PlanA'

    &&  record.Status=='Open'

    notexists join notExistsRecord

    where record.Plan == notExistsRecord.Plan

    && record.RecId != notExistsRecord.RecId;

    --second

    select record 

    where record.Plan=='PlanB'

    &&  record.Status=='Closed'

    notexists join notExistsRecord

    where record.Plan == notExistsRecord.Plan

    && record.RecId != notExistsRecord.RecId;

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,147 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans