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)

Executequery and queryfilter

(0) ShareShare
ReportReport
Posted on by

Hello,

I have a Grid on Form which shows fields from 2 datasources i.e. DS1 and DS2.  They are related using inner join.

Now i have to put 2 filter dropdown list. 1 dropdown is to filter values in DS1 and other is for DS2.

I have override executequery() of DS1  and  written below code.

--------------------------------------------------------------------------------------------------------------

public void executeQuery()

{

Querybuilddatasource qbds;

qbds = this.queryBuildDataSource();

if(DropdownList1.selection())

{

this.query().dataSourceNo(1).addRange(fieldNum(DS1,fieldname1)).value(somevalue);

}

if(DropdownList2.selection())

{

this.query().dataSourceNo(2).addRange(fieldNum(DS2,fieldname2)).value(somevalue);

}

super();

}

--------------------------------------------------------------------------------------------------------------

But this code throws error that 

Query missing QueryBuildDataSource for FormDataSource DS2

Can you please  help me understand what is wrong here? 

please note that I don't want to use sysquery::findorcreatedatasource() method to add table of DS2 in it. 

Do i need to write second filter code in executequery() of DS2 only? but in that case it may throw same error for DS1. please guide. Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    I suggest you should write filter code DS1 in executequery() of DS1

    and  filter code DS2 in executequery() of DS2

    Please verify this should work, please update us with your findings

  • Suggested answer
    Community Member Profile Picture
    on at

    You need to call executequery() method of both the datasource in modified method of both the dropdown filter values for DS1 and DS2

    Please verify if this helps you.

  • Community Member Profile Picture
    on at

    not sure how would executequery of DS2 would be called without successful execution  of executequery of DS1.

    The mentioned error is generated in executequery of DS1 so it the execution won't go ahead.

  • Maciej Obojski Profile Picture
    610 on at

    Hi VDY,

    I tried to reproduce your error with no luck: created a simple form, inner joined CustTable + SalesTable. Adding sample ranges on either CustTable or SalesTable, on CustTable's executeQuery works beautifully.

    Could you please post exact error message that AX is producing ?

    Maybe you can also share more information on nature of relations between the tables?

    Thanks,

    Maciej

  • Community Member Profile Picture
    on at

    Hi Maciej,

    Error message is like below

    Query missing QueryBuildDataSource for FormDataSource DS2

    and it has used inner join.

  • Maciej Obojski Profile Picture
    610 on at

    Hi VDY,

    unfortunately I cannot seem to replicate the problem - I have never encountered it as well.

    I am out of ideas - so unless you found a solution already, maybe you can post share the XPO/code that triggers the problem ? The exact version of your system might prove useful as well

    Thanks,

    Maciej

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