Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Cannot implicitly convert from type 'QueryGroupByField' to type 'QueryBuildDataSource'

Posted on by 125
  • M_R Profile Picture
    M_R 125 on at
    Cannot implicitly convert from type 'QueryGroupByField' to type 'QueryBuildDataSource'
       
       
        public void processReport()
        {
            ABCVendItemStatisticsNewContract  contract = this.parmDataContract() as ABCVendItemStatisticsNewContract;
            CurrencyExchangeHelper currencyExchangeHelper = CurrencyExchangeHelper::newLedger(Ledger::current());
            currencyExchangeHelper.parmErrorType(AifErrorType::Exception);
            fromDate_Period1    = contract.parmPeriodOneFromDate();
            toDate_Period1      = contract.parmPeriodOneToDate();
            fromDate_Period2    = contract.parmPeriodTwoFromDate();
            toDate_Period2      = contract.parmPeriodTwoToDate();
            
            QueryRun queryRun_Current = new QueryRun(this.buildPeriodQuery(this.parmQuery()));
            while (queryRun_Current.next())
            {
                CustInvoiceJour custInvoiceJour_Current     = queryRun_Current.get(tablenum(CustInvoiceJour));
                CustInvoiceTrans custInvoiceTrans_Current   = queryRun_Current.get(tablenum(CustInvoiceTrans));
                ItemId currentCustInvoiceTransItemId = this.parmCustInvoiceTransItemId(custInvoiceTrans_Current);
                boolean itemNEqPrev = itemId != currentCustInvoiceTransItemId;
                boolean accNEqPrev  = orderAccount != custInvoiceJour_Current.OrderAccount;
                periodNum = ItemReportPeriodNum::Both;
                if (accNEqPrev || itemNEqPrev)
                {
                    this.insertIntoTmpTable();
                    if (itemNEqPrev)
                    {
                        salesUnit = InventTableModule::find(currentCustInvoiceTransItemId,ModuleInventPurchSales::Sales).UnitId;
                    }
                    orderAccount    = custInvoiceJour_Current.OrderAccount;
                    itemId          = currentCustInvoiceTransItemId;
                    vendAccount = InventTable::find(itemid).PrimaryVendorId;
                }
                this.definePeriod(custInvoiceTrans_Current.InvoiceDate);
                
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    Cannot implicitly convert from type 'QueryGroupByField' to type 'QueryBuildDataSource'
    The bug is at line 39. The value returned by addGroupByField isn't QueryBuildDataSouce, therefore you can't assign it to the variable. You clearly meant assigning there the return value of addDataSource(). Then you can call addGroupByField() on the variable.
     
    I would fix your code if you gave it to us as text.
     
    Also, it seems to me you chose some meaningless categories for your question. Or can you explain how is it related to Management Reporter, Lifecycle Services, Documentation and so on? Please pay more attention to it next time.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans