Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Buffer of referenced d...
Finance forum
Unanswered

Buffer of referenced dataSource not found on class extension

Posted on by 4
()Hello,
 
I am not getting the buffer for my refenced dataSource(AD_PSATmpProjProposalTransGrouping) of  form in extension for the button "SelectAll"(I am writing the code on its onClicked)
 
 
the code I wrote is:-
  FormDataSource fds=sender.formRun().dataSource('AD_PSATmpProjProposalTransGrouping');
PSATmpProjProposalTrans localPSATmpProjProposalTrans,PSATmpProjProposalTransGrp ;
fds=sender.dataSourceObject();
        PSATmpProjProposalTransGrp=fds.cursor();
        
         while select PSATmpProjProposalTransGrp
         {
             info("1");
             PSATmpProjProposalTransGrp.selectForUpdate(true);
             PSATmpProjProposalTransGrp.Selected=NoYes::Yes;
            ttsbegin;
            PSATmpProjProposalTransGrp.update();
            ttscommit;
         }
        localPSATmpProjProposalTrans.setTmpData(PSATmpProjProposalTransGrp);
        FormButtonControl selectAllStd=sender.formRun().design().controlName("SelectAll");
        selectAllStd.clicked();
        fds.executeQuery();
 
 
  • Martin Dráb Profile Picture
    Martin Dráb 225,490 Super User on at
    Buffer of referenced dataSource not found on class extension
    You can also answer your question by yourself. Try to make such a call and try to compile the code. It'll fail, because QueryRun class doesn't have clearRanges() method, therefore the answer is "no, you can't use such a method, because it doesn't exist". Note that QueryRun class isn't used to define a query, it executes a query defined by a Query object.
     
    clearRanges() is a method of QueryBuildDataSource class. If you create a CoC extension of executeQuery() of your form data source and you want to remove ranges from this DS, the call will be this.queryBuildDataSource().clearRanges().
  • CU19060732-1 Profile Picture
    CU19060732-1 4 on at
    Buffer of referenced dataSource not found on class extension
    Hi @Martin, I have a new question can we use clearRanges() in queryRun method, something Like queryRun().clearRanges();
  • Martin Dráb Profile Picture
    Martin Dráb 225,490 Super User on at
    Buffer of referenced dataSource not found on class extension
    Please give us more details about your problem (I'm not sure what I am not getting the buffer means).
     
    By the way, I see that you assign the value of fds variable twice: first you put there sender.formRun().dataSource('AD_PSATmpProjProposalTransGrouping') and then you overwrite it with sender.dataSourceObject(), therefore the first assignment has no effect. If you want the latter, throw away first assignment - it's completely useless and it just make your code confusing. If you want the former, then throw away the latter, because it prevents what you want.
     
    By the way, the simplest way is using CoC and referring to the table buffer simply by name.

    (Moved from Dynamics AX forum.)

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans