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 :
Microsoft Dynamics AX (Archived)

Call non static method from Axapta in Dynamics Report Project

(0) ShareShare
ReportReport
Posted on by 1,683
How to call a non static method from Axapta in Dynamics Report Project.
For static methods I use :
AxaptaWrapper Ax = SessionManager.GetSession();
string customerName = "";
customerName = (string)Ax.CallStaticClassMethod("CustTableSSRSClass", "testMethodSSRS",accountNum);
return customerName;

And how to call methods from Tables?
For example in Axapta exists method bankAccountNum in CustTable
display BankAccount bankAccountNum()
{
return CustBankAccount::find(this.AccountNum, this.BankAccount).AccountNum;
}

How to call this method? and what will be "this" here, if I call this method from Dynamics Report Project?

*This post is locked for comments

I have the same question (0)
  • user5555 Profile Picture
    7,437 on at

    Hi,

    First of all I think you should consider a different design approach. The way you code and AX is coded is more like giving a database server and in case of AX a denial-of-service attack (DoS attack) to the AOS. If you want to design a high performance report on a large data sets you should try to avoid excessive overhead and multiple database calls. If you have a report with 1000 customers your statement bankAccountNum() calls for every customer the AOS and the database. So 1000 calls which can be reduced to 1 call: simply call the BankAccount number in a join on the datasource.

    Your data source should try to call in one statement the data required. If you want to retrieve related data, you call for the relationship and you can try if you can link the data relationships in your report again. This is the way you code in .net by using report viewer and I think it is a generic approach for designing working and high performances reports to end customers.

    At runtime creates an object from a construct at runtime. Within this object it is call this. It is to call methods etc. from within the instance/ object (at runtime when the object is created in memory). Since you use static methods, there is no object created in with you can use 'this'. The 'this' might be referring to the report, but I am not sure.

    Try to look for a matching report in the AOT and try to understand how it works before starting coding. The bank account num is called in the control balance list once you generate payments for the bank to process.

    J.

  • Adrian Pascari A Profile Picture
    1,683 on at
    I only need to know if I call non static methods from Axapta.
    I can use CallAxaptaFunction over BC, but I use only AxaptaWraper.
    can you, please, how to call methods from tables?
  • user5555 Profile Picture
    7,437 on at

    hI,

    I am not sure if we are talking about the same. I think you already used it. Here you call a class/ table. Look up in the AOT the table and call it like Address::insert(..). But most methods do not have a find/ search so you need to code something like 

    public myClass(AccountNum accountNum )

    {

    CustBankAccount _custBankAccount;

    select _custBankAccount where _custBankAccount.AccountNum = accountNum;

    }

    It can be that AccountNum does not exist, then use other type.

    Is this what you mean?

    J.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans