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, ...
Suggested Answer

Query as a form datasource - Display method

(0) ShareShare
ReportReport
Posted on by

Hi All,

This could be silly but i somehow can't get it done.

I have an AOT query as a datasource of the form. It has 2 columns  amount1 and amount2.

Form has a Grid  and i want to show only 1 amount that is greater between amount1 and amount2 in a single column.

How do i do it?  Can we write a display method for an AOT Query ? Thanks in advance.

Regards,

Vikky

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can write the display method in the form data source.

    https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-the-display-method-modifier#to-create-a-display-method

  • VRD Profile Picture
    on at

    Please note that my formdatasource is an AOT Query and not a Table. It doesn't allow me to add any method on the Query. Any dynamics standard form with such functionality having a display method on formdatasource (AOT Query) ?

  • WillWU Profile Picture
    22,361 on at

    Hi Vikky,

    Why you have to use a query as a formdatasouece?

    Queries are mainly used for reporting purpose...the main adavantage of query is filteration. Could you use a view as a datasource, then you could create a Computed column.

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

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Ah, you are right.

    Not sure if you can do it with queries. But you could use a view as your query data source (or directly as form data source) and add a computed column in the view.

    Of course depends on your query.

  • VRD Profile Picture
    on at

    Thanks Will and Niklaos.

    I have already explored that option of using View.  First of all, i can not add Query as a datasource into the View in D365FO.

    Secondly,  I have to use Query as it is being used at multiple places. Also, Query is using Aggregate Data Entity as its datasource.  D365FO doesn't allow to create a View using that Aggregate data entity as a datasource.

  • WillWU Profile Picture
    22,361 on at

    Hi Vikky,

    You could set the Query property of the view to create view based on query in D365FO.

    pastedimage1607674690338v1.png

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi,

    you are right, Query can't be used as a view data source. Queries are x++ objects, but views are SQL Server objects. And SQL Server can't use x++ objects as it's data source.

    But you can use a view as a query data source.

    Anyway, could you perhaps add this required field directly in the aggregate data entity?

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Will Wu nice, I was not aware of that you could use a query as a data source for a view. I assume there must be some limitations. But, quite cool.

  • VRD Profile Picture
    on at

    Thanks Will.

    I was trying to add a datasource in the view and datasource always needs to be Table. But at View level, i can set its Query property. I will implement this and let you know how it goes.

  • VRD Profile Picture
    on at

    The problem is the aggregate entity. D365FO doesn't allow Aggregate entity to be part of View, not even if you add Query as a datasource  in the view.

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans