Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

I am getting an error of stack trace

Posted on by 132

private void groupBY()
{
query = new Query();
qbdsParent = query.addDataSource(tableNum(CustTable));
qbdsChild = query.addDataSource(tableNum(CustTrans));

qbdsChild.joinMode(JoinMode::InnerJoin);
qbdsChild.fetchMode(QueryFetchMode::One2Many);
qbdsChild.relations(true);
qbdsChild.addLink(fieldNum(CustTable,AccountNum),fieldNum(CustTrans,AccountNum));
qbdsChild.orderMode(OrderMode::GroupBy);
qbdsChild.addSortField(fieldNum(CustTable,CustGroup));
qbdsChild.orderMode(OrderMode::OrderBy);
qbdsChild.addSortField(fieldNum(CustTable,CustGroup));

queryRun = new QueryRun(query);

while(queryRun.next())
{
custTable = queryRun.get(tableNum(CustTable));
custTrans = queryRun.get(tableNum(CustTrans));
info(strFmt("%1 %2 %3 %4 %5", custTable.AccountNum, custTable.CustGroup));
}
}

I am getting  an error is this --->>

Stack trace: The method has been called with an invalid number of parameters.

*This post is locked for comments

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: I am getting an error of stack trace

    Hi,

    can you please let us know which place you are getting the error,so that we can suggest you a better solution.

    Use code editor always to paste your code for better reading and understanding.

    Regards,

    AXTechie2120

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: I am getting an error of stack trace

    fieldNum function needs two parameters, table name and field name. You are passing one parameter: value of CustTable.AccountNum / CustTrans.AccountNum. Which will obviously not work.

    In addition in your strFmt you have 5 placeholders but you pass only two values.

    https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-ref/xpp-compile-time-functions#fieldnum

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans