Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

If else in AOT Query Object ? need advise

(0) ShareShare
ReportReport
Posted on by 10

Hello All, I am trying to build a query but not sure if it would be possible to build using the AOT query object. If this is not possible in AOT i could use some advise on what would be the best way to do this 

Essentially what i am trying to do is join two queries that i have created on the field MAINAccount - See below 

The main purpose of the query is to look at if the mainaccount has override dimensions in this case Query 1 pulls from the MainaccountoverideLegalEntity table 

The way the query would work is look at the field 'DimensionFixed' in Query 1 and the logic would be to return a new field as 

pastedimage1673890062207v2.png

If Dimensionfixed = "Fixed-Fixed" than take 'Default Dimension Display value' from Query 1 , Result = "10-10 "

Else if

If Dimensionfixed = "NotFixed-NotFixed" then take LedgerAccount from Query 2 , Result = 10-11

Else

If Dimensionfixed = "Not Fixed-Fixed" then take the first dimension from Query 2 and the second dimension from Query 1 which would result in 10-20 in this case  

The two main questions I have is can i do this in AOT query object, if not than do you recommend a X++ query in a Form that pulls these two query objects 

and the SECOND is can i use substring functionality to extract dimension values from these two fields 

'Default Dimension Display value' & 'LedgerAccount', they are both strored as Strings but are extended data types 

Any guidance would be appreciated, been stuck on this for quite some time 

  • razamatazz Profile Picture
    razamatazz 10 on at
    RE: If else in AOT Query Object ? need advise

    Thank you Andre, that is what i was looking for.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,031 Super User 2025 Season 1 on at
    RE: If else in AOT Query Object ? need advise

    Hi razamatazz,

    A query itself if not able to have this if-statement. You can create a view with a calculated column. Then you can embed that view in a query or use it on a form or somewhere else.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans