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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

AOT query: conditional node inclusion

(0) ShareShare
ReportReport
Posted on by 6,609

Hello:

I really hope I'm able to describe this question properly. Please bear with me.

The example scenario: I have an AOT query with SalesLines as the main datasource. For the given item (variant) on each line, I'm looking for the a unit cost value for this item which either: 1) comes from the price on the last PO for this item (variant), OR 2) a value tied to the customer on this sales order. Structurally, on the query I would have two views under Sales lines, one responsible for gathering the PO price, while the other gathers the customer price. And so to recap the query structure, it has two levels only: Sales lines at the top, then under it, the two views as described above.

The question I have is this: the price values the two views gather are mutually exclusive but is prioritized in the sense that if I have a PO value, I don't need the customer-specific value. Only in the case when I'm not able to retrieve a PO value do I look to the customer-specific value. Is it possible within the AOT query to configure it in such as way that if I have a non-zero value returned from the PO view, the AOT query should ignore the customer-specific view. You may be asking why I might want to do something like this. Let's say the two views have a multitude of considerations /  conditions to consider in retrieving each value, so to reduce the complexity of the ultimate query to SQL, and reduce the overall processing time, I want to selectively run the second view only if the first view returns a zero value. 

Hopefully that made sense.

Thank you!

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi Ichiban,

    You can achieve it with computed columns on views. You can read the documentation and a blog from Martin Drab for more information:

    docs.microsoft.com/.../walkthrough-add-a-computed-column-to-a-view

    dev.goshoom.net/.../

  • bankk Profile Picture
    6,609 on at

    Hi Andre,

    Thank you for the links to the references. I just wanted to verify It doesn't appear there's a way configure the Query to mutually exclude the two pricing Views. From the reading, it seems that I could put the Query into another View and add a computed column to retrieve the price value I need.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi Ichiban,

    You can do virtual columns on a view; not on a query. However, you can include a view as datasource on a query.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans