Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Filter data based on the lower level satasource

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filter data based on the lower level satasource

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filter data based on the lower level satasource

    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

  • Verified answer
    Anton Venter Profile Picture
    Anton Venter 18,788 Super User 2024 Season 2 on at
    RE: Filter data based on the lower level satasource

    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));


  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Filter data based on the lower level satasource

    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.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    RE: Filter data based on the lower level satasource

    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?

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!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans