Subformlink multiple selection

Kylea
Member Posts: 39
We have a Customer table with a <Cust No.> and a <Cust 2 No.> field on it.
We also have an allotment table on which <Cust No.> and <Cust 2 No.> may have received the same allotment - ie they bought it in partnership.
We have created a customer card with a subform (the subform is over the Allotment table). We want to list all allotments related to the Customer selected. The trick is that the Customer may have purchased allotments as either <Cust No.> or <Cust 2 No.> field.
Ideally it would be nice to have a subform link of the following:
Cust No.=FIELD(No.) or Cust 2 No. = FIELD(No.)
OK - back in the real world now.....I know there is no OR relationship.
Has anyone coded a subform to mark records so that both selection sets can be processed - can this be done,....any suggestions? :?: :?: :?:
Cheers
Kylea White
Senior Developer
We also have an allotment table on which <Cust No.> and <Cust 2 No.> may have received the same allotment - ie they bought it in partnership.
We have created a customer card with a subform (the subform is over the Allotment table). We want to list all allotments related to the Customer selected. The trick is that the Customer may have purchased allotments as either <Cust No.> or <Cust 2 No.> field.
Ideally it would be nice to have a subform link of the following:
Cust No.=FIELD(No.) or Cust 2 No. = FIELD(No.)
OK - back in the real world now.....I know there is no OR relationship.
Has anyone coded a subform to mark records so that both selection sets can be processed - can this be done,....any suggestions? :?: :?: :?:
Cheers
Kylea White
Senior Developer
0
Comments
-
You need to create a function in your subform. This function receives the master record and must mark all the records to show and at the end do a Currform.UPDATE(FALSE);
In the OnAfterGetCurrentRecord of the header, you need to call the function in the subform. Remember to give your subform a name, otherwise you can't access it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi,
Thankyou for your help Kriki.
Following your instructions this is what I did.
1) Removed existing subform link from Customer Card. F21
2) Added function [MarkAllotRecs] with parameter to receive Rec as per below to subform F50128MarkAllotRecs(Grower : Record Customer) CLEARMARKS; RESET; SETCURRENTKEY("Grower No."); SETRANGE("Grower No.",Grower."No."); IF FIND('-') THEN REPEAT MARK(TRUE); UNTIL NEXT = 0; //Unfilter Grower No. SETRANGE("Grower No."); SETCURRENTKEY("JV 2 Grower No."); SETRANGE("JV 2 Grower No.",Grower."No."); IF FIND('-') THEN REPEAT MARK(TRUE); UNTIL NEXT = 0; SETRANGE("JV 2 Grower No."); SETCURRENTKEY("Global Dimension 2 Code","No."); MARKEDONLY(TRUE); CurrForm.UPDATE(FALSE);
3) Add code to Customer Card OnAfterGetCurrRecord as per below.Form - OnAfterGetCurrRecord() CurrForm.AllotList.FORM.MarkAllotRecs(Rec);
Hopefully someone else will get some benefit from this.
Thanks again.
Kylea White0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions