SubformLink using two fields on link

soltadis
Member Posts: 5
Hi,
I'm trying to create a form that contains a header table and a line table, using the sales line table.
The SubformLink that I used in my customized subform is:
Document No.=FIELD(Contract No.),Group Entry No.=FIELD(No.)
My problem is that when I try to create a new record in the subform, while the Document No. is being filled automatically by the SubformLink, the "Group Entry No." field is left blank.
I have tried to solve this by adding that field as a key on the sales line table, as well as switching the order between the two fields on the SubformLink, but neither of them worked.
The other approach I used was to create a subroutine in the subform, and call it from the header. Even though the subform routine gets the value successfully, the new record begins again with that column left blank.
The subroutine is:
SetGroupEntryNo(GroupEntryNo : Integer)
"Group Entry No." := GroupEntryNo;
CurrForm.UPDATE(FALSE); // I inserted this line after reading another post suggestion on a a similar issue. I tried without that statement, but I achieve the same result.
Any idea of how can this be solved? Any suggestion will be appreciated. Thank you very much for your attention.
I'm trying to create a form that contains a header table and a line table, using the sales line table.
The SubformLink that I used in my customized subform is:
Document No.=FIELD(Contract No.),Group Entry No.=FIELD(No.)
My problem is that when I try to create a new record in the subform, while the Document No. is being filled automatically by the SubformLink, the "Group Entry No." field is left blank.
I have tried to solve this by adding that field as a key on the sales line table, as well as switching the order between the two fields on the SubformLink, but neither of them worked.
The other approach I used was to create a subroutine in the subform, and call it from the header. Even though the subform routine gets the value successfully, the new record begins again with that column left blank.
The subroutine is:
SetGroupEntryNo(GroupEntryNo : Integer)
"Group Entry No." := GroupEntryNo;
CurrForm.UPDATE(FALSE); // I inserted this line after reading another post suggestion on a a similar issue. I tried without that statement, but I achieve the same result.
Any idea of how can this be solved? Any suggestion will be appreciated. Thank you very much for your attention.
0
Comments
-
Thanks for your immediate reply. Well, I've just tried your suggestion, but it didn't work. I also played around with different combination of keys and SubformView sortings, but the "Group Entry No." column is left blank, while Document No. gets Contract No. successfully.0
-
Sure.
Sales Line table keys:
Document Type,Document No.,Line No.
Document Type,Type,No.,Variant Code,Drop Shipment,Location Code,Shipment Date
Document Type,Bill-to Customer No.,Currency Code
Document Type,Type,No.,Variant Code,Drop Shipment,Shipment Date
Document Type,Blanket Order No.,Blanket Order Line No.
Document Type,Document No.,Location Code
Document Type,Shipment No.,Shipment Line No.
Type,No.,Variant Code,Drop Shipment,Location Code,Document Type,Shipment Date
Document Type,Document No.,Type,No.
Document Type,Sell-to Customer No.
Document No.,Group Entry No.
I created the last one, and also tried it inverted. Same with the sortings but nothing.0 -
I found a workaround solution. It's not as efficient as using the SubformLink, though. Well I just made use of the aforementioned subroutine. However, instead of trying to insert the incoming parameter value into "Group Entry No." I just copied it to a global variable, which in turn I used in a lookup filter, where I intended to use the "Group Entry No." at first.
Here is a snippet of the code in case it becomes handful to someone with a similar issue:
// Subroutine defined on subform>>
SetGroupEntryNo(GroupEntryNo : Integer)
GlobalGroupEntryNo := GroupEntryNo;
CurrForm.UPDATE(FALSE);
// Subroutine defined on subform<<
// Field definition on subform>>
No. - OnLookup()
IF MySalesHeader2.GET(GlobalGroupEntryNo) THEN BEGIN
MyItem.SETFILTER("Item Group", MySalesHeader2."Item Group");
IF FORM.RUNMODAL(FORM::"Item List", MyItem) = ACTION::LookupOK THEN BEGIN
VALIDATE("No.", MyItem."No.");
"Copy of No." := "No.";
"Group Entry No." := GlobalGroupEntryNo; // Insert "Group Entry No." value.
END;
// Field definition on subform<<
If someone finds a way to get the values for two or more fields defined on SubformLink, from the header form, please feel free to post the solution. Thank you very much for your attention.0
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