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)

Link VS DynaLink

(0) ShareShare
ReportReport
Posted on by

Hello.

I need to know about the differences between Link and Dynalink.

Need a simple example of:

Link in code two tables, and ignore the default link between them.

i.e SalesTable + SalesLine ...

Connect them by some other column (or columns).

 

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    Below an example. Feel free to change the link. The infolog will show the xml representation of the query, which I've found to be helpful in debugging sometimes.

       Query                   query;

       QueryBuildDatasource    datasource;

       ;

       query = new Query();

       // Add SalesTable main datasource

       datasource = query.addDataSource(tableNum(SalesTable));

       // Add child datasource "SalesLine" to previously created DS

       datasource = datasource.addDataSource(tableNum(SalesLine));

       // Indicate you don't want to use relations automatically

       datasource.relations(false);

       // Add link between parent field and child field

       datasource.addLink(fieldNum(SalesTable, SalesId), fieldNum(SalesLine, SalesId));

       info(query.xml());

  • Suggested answer
    Denis Patrakov Profile Picture
    on at

    A link creates a join (inner by default) between two QueryBuildDatasources of the same query. Data from the corresponding tables is fetched simultaneously, in a single query to the database. A dynalink creates additional where clauses on a data source, and its data is fetched in a  subquery - separately from the dynalinked data source. Dynalinks are a great feature of Dynamics AX that allows data in different forms to be "synchronized" while you navigate through data on one form.

  • Community Member Profile Picture
    on at

    The function addDynalink takes 3 arguments.

    The second argument is "common _DynamicFile" - What is it for?

    Thanks ;)

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    Dynalink will update a query based on a "live" table buffer. This is used between forms, as gl00mie explained, so if you have two forms open one form will update it's query if you select a different record on the other. This is achieved by adding a dynalink on a specific field, and passing in the record (common) to trigger from. I don't see this being useful in a regular query object, although I must assume it works (I never tried).

    You can see this process in action for example if you go to inventory management > item details and click on "transactions". Leave the transactions form open but select a different item in your item details screen. AX automatically does dynalinking a lot on forms, based on the args.record() being passed along.

  • Community Member Profile Picture
    on at

    In form: custPackingSlipJournal, dataSource: custPackingSlipJour, method: init, there is a code behind.

    I want to understand that code ... and can I do the Dynalink otherwise (I want to do the same, but limit it to a specific item).

    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

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