Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to add dynamically existing form datasource to parent query

Posted on by 5

Hi All,

This is my first question in this forum and i'm newbie in Dynamics AX.

i want to join to BOM query existing datasource RDTable as child of BOM datasource. However when i'm doing it from code a new instance of RefDesTable(RefDesTable_1) is created. i want only to "move" this RDTable from RDTable query to BOM Query. Of course i don't want to to this from properties but from code(i have to dynamically add it from code by button and show in grid one of my columns joined refdestable). My jointype between BOM Datasource and RefDesTable is OuterJoin. 

0045.pic1.PNG

This is my code how i want to add this from code 

this method is written in BOM datasource and called in button

5287.pic2.PNG

Am i able to do this from code?

thanks

*This post is locked for comments

  • Tamasa94 Profile Picture
    Tamasa94 5 on at
    RE: How to add dynamically existing form datasource to parent query

    It worked! Thanks a lot :)

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to add dynamically existing form datasource to parent query

    Yes, it should work. Please go and try it; don't wait for an approval. We learn by trying.

  • Tamasa94 Profile Picture
    Tamasa94 5 on at
    RE: How to add dynamically existing form datasource to parent query

    Thank you for advice.

    How can i disable my RefDesTable DS?

    something like this?

    this.query().dataSourceTable(tablenum(RefDesTable)).enabled(false);

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to add dynamically existing form datasource to parent query

    I would do it differently. Instead of building it from code when needed, I would configure it as needed in the designer and merely disable it from code when it shouldn't apply.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans