Skip to main content

Notifications

Announcements

No record found.

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

Display method on the view

(0) ShareShare
ReportReport
Posted on by 425

Hi All,

I am trying  to create a view and I have used the view as the datasource  of my form  but I want to use a display method 

I have seeen the example in the standard view "CustGrossMarginbyAccount_NA" how they have created a display method 

    display SalesContributionMarginMST contributionMarginMST()
    {
        SalesCostValue salesCostValue;

        salesCostValue = this.costValue();

        return this.LineAmountMST - salesCostValue;
    }

I have created a display method like below :

    display AmountMST remainAmountMST()
    {
        CustTrans CustTrans;

        CustTrans = CustTrans::find(this.RecId1);

        return CustTrans.remainAmountMST();
    }

then i have created a real field  and I have selected the view  and in the datasource 

31460.png

and it gives an error 

Severity Code Description Project File Line Suppression State
Error Path: [AxForm/CustTransOpenInvoice/Design/Controls/FormGrid/Controls/FormRealControl2/DataMethod:The data method 'remainingAmountMST' was not found on the data source 'CusttransOpenInvoice' or its base table/view. RentAndServices (VAR) [RentAndServices K:\AosService\PackagesLocalDirectory\RentAndServices\RentAndServices\AxForm\CustTransOpenInvoice.xml 0

display AmountMST remainingAmount()
{

AmountMST amount = CustTrans::find(CusttransOpenInvoice.RecId).remainAmountMST();
return amount;

}

Even I have created a display method in the datasource level  and it is not reflecting the correct value 

Kindly help I am using D 365 FO

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,503 Most Valuable Professional on at
    RE: Display method on the view

    The method in the last code snippet has yet another name remainingAmount() and it should accept a table buffer as a parameter; if it's written on a form data source.

    (Thread moved from Dynamics AX forum.)

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: Display method on the view

    Hi Rohit,

    The method name as per your code snippet is "remainAmountMST".

    The data method name on the control should be the same name. Right? From your screenshot, I can see it is "remainingAmountMST".

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans