A question I sometimes get asked when I deliver a Dynamics NAV 2009 development training is: Is it still possible to link a part to another part on a page, like you can do with two subforms on a form?
The answer is: Yes you can. There's a property that you can use to connect different parts on a page: the ProviderID property.
Example:
Lets create a new List Page for Salespersons. And on this Page let's also show the customers for each salesperson and the comments for each customer.
- Start by creating a new Page, Page Type List and Source Table: Salesperson/Purchaser.
- Add a Part to the Page and link it to Page 22, Customer List.
- In the SubFormLink property of the Part, link the Customer to the Salesperson: Salesperson Code=FIELD(Code)
- Remember the value of the property ID for the part. For example: 1000000004
- Add another part to the Page and link it to Page 125, Comment List.
- Then, go to the properties of this part and type the value 1000000004 in the property: ProviderID.
- Now, you can go into the SubFormLink property of this part, and you can connect it to the Customer List part: Table Name=FILTER(Customer),No.=FIELD(No.)
- And voila, you're ready. Save, compile and run you page:
Copy the Example SalesPersonsCustomersComments.txt:
OBJECT Page 59000 Test SalesPersons { OBJECT-PROPERTIES { Date=28/04/10; Time=16:24:18; Modified=Yes; Version List=; } PROPERTIES { Editable=No; SourceTable=Table13; PageType=List; } CONTROLS { { 1000000000;;Container; CaptionML=ENU=ContentArea; ContainerType=ContentArea }
{ 1000000001;1;Group ; GroupType=Repeater }
{ 1000000002;2;Field ; SourceExpr=Code }
{ 1000000003;2;Field ; SourceExpr=Name }
{ 1000000004;1;Part ; SubFormLink=Salesperson Code=FIELD(Code); PagePartID=Page22 }
{ 1000000005;1;Part ; SubFormLink=Table Name=FILTER(Customer), No.=FIELD(No.); PagePartID=Page125; ProviderID=1000000004 }
} CODE {
BEGIN END. } } |
Comments