web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filter data based on the lower level satasource

(0) ShareShare
ReportReport
Posted on by

There is any way to Filter Upper data source based on Lower One?

I want to filter data on Grid1 wich contain itemId from InventTable based on BOMQty  on G2 from BOM Table

BOM Table is  related to InventTable as follows:

6116.Capture.PNG

Code:

queryBuildDataSource = BOM_ds.query().addDataSource(tableNum(BOM));
           queryBuildDataSource = queryBuildDataSource.addDataSource(tableNum(InventTable));
           queryBuildDataSource.relations(true);
           queryBuildDataSource.addLink(fieldNum(InventTable, ItemId), fieldNum(BOM,ItemBOMId));

           QtyQBR = queryBuildDataSource.addRange(fieldnum(BOM,BOMQty));
           QtyQBR.value(queryvalue(SearchStringEdit.text())); // a filter field

           BOM_ds.executeQuery();

when i run it i get the following error: "Les requêtes comptant plusieurs sources de données de niveau supérieur ne peuvent pas être appliquées aux écrans."

Thanks

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    306,303 Super User 2026 Season 1 on at

    Hi Ennasri,

    Please update the question with some more information. Is this is a custom form with use of temporary tables? What is the exact error message in English?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    That would be a circular reference. The changing value of the inner datasource would trigger a refresh on the outer datasource, which then refreshes the inner datasource again so it goes in a loop.

    You have to know and apply the filtering criteria up front. Also you are trying to add the same tables again that I assume already exist in your form with addDataSource, which is wrong.

  • Verified answer
    Anton Venter Profile Picture
    20,848 Super User 2026 Season 1 on at

    Hi, you are getting this error because it seems you are adding a second BOM datasource the existing BOM datasource. I am assuming you have a BOM datasource. Try to change your first line to:

    queryBuildDataSource = BOM_ds.query().dataSourceTable(tableNum(BOM));


  • Community Member Profile Picture
    on at

    Thank you for replying, yes it was an existing BOM Datasource,this fixed the error problem, but i still not able to get result with filter

  • Community Member Profile Picture
    on at

    Hi Thank you for replying, yes it was an existing BOM Datasource

    I didn't understand your note, what is the meaning of " apply the filtering criteria up front"?

    Thanks.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans