Skip to main content

Notifications

Microsoft Dynamics AX forum
Unanswered

In AX2012R3 form with 3-level DS's - show all records from (3rd level) in a delayed join on level 1

Posted on by 18
Hello,
 
in AX2012R3 form - I have  3 levels of data sources: A -< B -< C, where there is a relation from B towards A and from C towards B. but no AOT relation directly from C to A. I need to show the records all records from level C, which are related to A.
The problem I am facing is that if on DS: C  I set the join source to be DS: A (as there is no direct relation from C to A) - the generated query for C does not include any joins to A, and also I am not able to addLink from C to A as I get the error: /The data source is not embedded within a (parent) data source./. Not sure if this is possible to modify the query of a delayed join - to somehow join to a table from the main form's query ( = an upper level DS). 
I tried also with a using a view BC (created on tables B & C), but this view does not seem to know that there is a relation from B to A and on the view there are no explicit Relations to be defined. I am not sure if the view is created via some AOT queries - that the relation BC to A would appear. Setting the join source of C to B, is obviously not correct, as the records shown are only the ones from an the active (e.g. the first record of B).
So my question is - is it possible somehow to implement this - without using e.g. ranges for BC - which would be updated in the active() method of data source A and updated in the executeQuery() of data source C?
 
Thank you in advance!
Nikolay Nikolov
 
 
  • NNikolov Profile Picture
    NNikolov 18 on at
    In AX2012R3 form with 3-level DS's - show all records from (3rd level) in a delayed join on level 1
    Martin, thank you for the quick reply!
     
    Sorry for my unclear question. So the situation is indeed data sources:  [A -< B-< C >- D ]  (e.g. A:(Journal) -< B:(Lines) -< C:(line-packs) <- D:(packs)) where it is possible that there might exist also several lines on a pack. I need to show on a separate grid all D-packs available for an A-journal without repetition (e.g. due to a join with multiple C:(line-packs) records. As there are also quite a lot of other data sources available on the form, I should preferably not mess with the main query - but rather have a separate query for the extra functionality). 
     
    I guess my mistake is indeed (as you mentioned) in the use of addLink() instead of addDynalink() - as I would like to influence only the separate delayed query, to take into account the selected A-level record for filtering on D. Hopefully with addDynalink() I can refer to a Data source which is not directly available in the local -/separate/delayed query.
     
    Thank you again for your time!
    Kind regards,
    Nikolay 
  • Martin Dráb Profile Picture
    Martin Dráb 223,370 Super User on at
    In AX2012R3 form with 3-level DS's - show all records from (3rd level) in a delayed join on level 1
    First of all, you began with statement that the hierarchy of data sources is A -< B -< C, but the rest of the posts suggests that it's not true - you say that you want to link C to A, not to B. Can you explain this discrepancy, please?
     
    Then you mentioned delayed join, but Delayed isn't a join - it's a link. The difference is that a join add the data sources to a single query, while a link creates a separate query for each data source, with the child data source filtered by the active record of the parent data source.
     
    addLink() is used with joins, so it won't help you if you want a deployed link instead of a join. With links, use addDynalink() instead.

Helpful resources

Quick Links

Upcoming TechTalk: Copilot Capabilities…

Review the Copilot features that are currently available in Dynamics 365 Finance…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,405 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,370 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans