Form datasource LinkTypes and what they do

TL;DR

Use Delayed if the form has two related grids of data.
Use InnerJoin or OuterJoin if the form has one grid displaying data from both form datasources.
Use ExistJoin or NotExistJoin if the form has one grid but there’s no need to display data from the related datasources.
Don’t use Passive or Active.

Explanation

I’ve interviewed quite a few Dynamics AX developers, and I’m often shocked by a common response I get to questions about how the LinkType property works on form datasources:

“Hm, I’m not sure. I just fiddle with that property until the form seems to act correctly.”

Wait, what?

The significance of LinkType is that it will determine what happens to the form’s queries when the form initializes. There are two important scenarios to understand:

1 – Delayed / Active / Passive: The form creates a query for each datasource.

2 – InnerJoin / OuterJoin / ExistJoin / NotExistJoin: The form creates a single query containing both datasources.

Scenario #1

When the “parent” datasource fires the init() method, it constructs a query for the parent datasource.

When the “child” datasource fires the init() method, it constructs a query for itself and creates a dynamic link to the parent datasource’s record. This causes the behavior of whenever the parent record selection changes, the “child” datasource executes its query.

DynamicLink

Scenario #2

When the “parent” datasource fires the init() method, it constructs a query for the parent datasource.

When the “child” datasource fires the init() method, it will modify the “parent” query to add itself as a child datasource.

InnerJoin

In both of these cases, it’s fairly easy to see what’s going on by going to [Right click on form > Personalize > Query tab].

The behavior of Delayed is to cause a short delay between the “parent” record’s selection and the child datasource’s query execution. This is for performance reasons. If, for example, a user is tapping or holding down an arrow key, there’s no need to select the related records until the user stays on a record.

In contrast, Active does not have such a delay. I have not yet found an appropriate reason to use this LinkType, because it seems to only be a performance decrease for the form.

Passive will never automatically fire the query, so really only has a use if the intention is to fire the child query from code. Conceivably, this could be used in conjunction with a button to fire the child query in cases where it’s somewhat long-running. I haven’t found a compelling need to use this LinkType either.

It should be noted that ExistJoin and NotExistJoin will not select the information from the datasource, and should only be used when the intention is to use the related table of data essentially as a “filter” for the parent datasource.

I hope this helps you avoid playing “property roulette” until the form starts behaving.

Advertisements