Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Linking Parent and Child Grids on a form

(0) ShareShare
ReportReport
Posted on by

The Parent Grid is based on the purchase table and the Child Grid is based on vendinvoiceTrans

It's linked the the PurchID but the child grid show all the related records.

What am I doing wrong?

Thanks

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: Linking Parent and Child Grids on a form

    Does VendinvoiceTrans have a relation to PurchTable? If not, the system doesn§t know how to create the link. You would need to either add a relation in AOT or use addLink() when intializing the form.

    But if you want transactions for several selected orders, you incdeed need to do it in code.

  • brianmaric Profile Picture
    brianmaric on at
    RE: Linking Parent and Child Grids on a form

    Yes that is what I meant.  I see all the related records despite a correct link (PurchId)

    2313.PurchTable.PNGVendInvoiceTrans.PNG

    btw, the adding the following code to executeQuery method of VendInvoiceTrans seems to do the trick..

     public void executeQuery()
            {
                QueryBuildDataSource qbds;
                QueryBuildRange qbr;
    
                MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
                selectionHelper.parmDataSource(PurchTable_ds);
    
                QueryBuildDataSource VendInvoiceTransQbds = VendInvoiceTrans_ds.queryBuildDataSource();
    
                PurchTable purchTablelocal = selectionHelper.getFirst();
                while (purchTablelocal)
                {
                    VendInvoiceTransQbds.addRange(fieldNum(VendInvoiceTrans, PurchId)).value(queryValue(purchTablelocal.Purchid));
                    purchTablelocal = selectionHelper.getNext();
                }
    
                super();
            }

     I'm wondering if this is the best way to do this..

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,074 Super User 2025 Season 1 on at
    RE: Linking Parent and Child Grids on a form

    Hi Brianmaric,

    Can you describe what you mean with "but the child grid show all the related records"? Do you mean to say, you see all VendInvoiceTrans records despite a correct link between these tables? Can you share how you defined the join relation on the form data sources?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans