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
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
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156