Hi everyone,
I have created 2 tables named Integration Header and Integration Lines respectively.
The Primary key of the 2 tables is a field named Entry No. which is an Auto Increment integer field. In the Integration Line , I have another field named IntegrationHeaderEntryNo which refers to the field Entry No of the Integration Header (via Table Relation) in order to create a Parent-Child relationship.
I have also created 2 pages of type list part i.e. one for each table.
Then I have created a Card page, showing the 2 list parts as follows;
page 50103 Documents { ApplicationArea = All; Caption = ' Documents'; PageType = Card; UsageCategory = Administration; layout { area(content) { part(IntegrationHdr; IntegrationHdr) { ApplicationArea = all; } part(IntegrationLine; IntegrationLine) { ApplicationArea = all; Provider = IntegrationHdr; SubPageLink = HeaderEntryNo = field(bfmt_EntryNo); } } } }
Hi everyone, issue solved. The culprit was the below line of code
field(DeclineReason; Rec.DeclineReason)
{
Caption = 'Decline Reason';
ToolTip = 'Specifies the Decline Reason.';
ShowMandatory = Rec.isDeclined;
}
In the list part of the integration header.
Thanks a lot for your help, everyone!
Hi Y_A,
If you want to filter the line records based on the records selected on the header, I suggest using a Document or ListPlus with the header table as the source. Then, create a repeater with all the necessary fields on the document page and create a list part for the line table. You can attach the list part to the document page and filter the records on the line for each header record on the document grid.
Regarding the key value, I recommend using a similar field as the key in both tables, such as Document No. This field should uniquely identify each record on the header and use the same field as the key in the line table. For example, you can use Line No. and Document No. as the primary key on the line table. Finally, link the page part on your document page like this => SubPageLink = Document No. = field(Document No.);
I can send you the code if you want.. and if you have any confusion feel free to ask..
Regards
Sure, below is the code;
Integration Line
table 50103 IntegrationLine { Caption = 'IntegrationLine'; DataClassification = ToBeClassified; fields { field(1; DocID; Text[40]) { Caption = 'ShipServDocID'; DataClassification = ToBeClassified; } field(2; LineID; Guid) { Caption = 'ShipServLineID'; DataClassification = ToBeClassified; } field(3; "Line No"; Integer) { Caption = 'Line No'; DataClassification = ToBeClassified; } field(4; ItemNo; Text[80]) { Caption = 'ShipServItemNo'; DataClassification = ToBeClassified; } field(5; ItemNo; Code[20]) { Caption = 'ItemNo'; DataClassification = ToBeClassified; TableRelation = Item."No."; } field(6; CrossReferenceNo; Code[20]) { Caption = 'CrossReferenceNo'; DataClassification = ToBeClassified; TableRelation = "Item Reference"."Reference No."; trigger OnValidate() var Item: Record Item; ItemReference: Record "Item Reference"; begin ItemReference.SetFilter("Reference No.", CrossReferenceNo); if ItemReference.FindFirst() then begin if Item.Get(ItemReference."Item No.") then begin Rec.Validate(Rec.ItemNo, Item."No."); Rec.Validate(VendorNo, Item."Vendor No."); Rec.Modify(); end end; end; } field(7; Description; Text[2048]) { Caption = 'Description'; FieldClass = FlowField; CalcFormula = lookup(Item.Description where("No." = field(ItemNo))); } field(8; Quantity; Decimal) { Caption = 'Quantity'; DataClassification = ToBeClassified; } field(9; UOM; Code[20]) { Caption = 'UOM'; DataClassification = ToBeClassified; TableRelation = "Item Unit of Measure"."Code" where("Item No." = field(ItemNo)); } field(10; UnitPrice; Decimal) { Caption = 'UnitPrice'; DataClassification = ToBeClassified; } field(11; Comment; Text[512]) { Caption = 'Comment'; DataClassification = ToBeClassified; } field(12; VendorNo; Code[20]) { Caption = 'VendorNo'; DataClassification = ToBeClassified; TableRelation = Vendor."No."; } field(13; Model; Text[512]) { Caption = 'Model'; DataClassification = ToBeClassified; } field(14; SerialNo; Text[512]) { Caption = 'Serial No.'; DataClassification = ToBeClassified; } field(15; SalesQuoteNo; Code[20]) { Caption = 'SalesQuoteNo'; DataClassification = ToBeClassified; TableRelation = "Sales Header"."No." where("Document Type" = filter(0)); } field(16; SalesQuoteLineNo; Integer) { Caption = 'SalesQuoteLineNo'; DataClassification = ToBeClassified; TableRelation = "Sales Line"."Line No." where("Document Type" = filter(0), "Document No." = field(SalesQuoteNo)); } field(17; DocumentNo; Code[20]) { Caption = 'Document No.'; DataClassification = ToBeClassified; TableRelation = IntegrationHdr.DocumentNo; } field(18; Decline; Boolean) { Caption = 'Decline'; DataClassification = ToBeClassified; } field(19; DeclineComment; Text[2048]) { Caption = 'Decline Comment'; DataClassification = ToBeClassified; } field(20; IntDocHeaderID; Guid) { DataClassification = ToBeClassified; Caption = 'Integration Doc Header ID'; } field(21; QtyMainLocAsAtCalculation; Decimal) { DataClassification = ToBeClassified; Caption = 'Qty. as at Calculation'; } field(22; LineDescription; Text[512]) { DataClassification = ToBeClassified; Caption = 'ShipServ Line Description'; } field(23; EntryNo; Integer) { AutoIncrement = true; } field(24; HeaderEntryNo; Integer) { TableRelation = IntegrationHdr.EntryNo; } } keys { key(PK; EntryNo) { Clustered = true; } } }
Integration Header
table 50110 IntegrationHdr { Caption = 'IntegrationHeader'; DataClassification = ToBeClassified; fields { field(1; "ExternalSystem ID"; Text[40]) { Caption = ' ID'; DataClassification = ToBeClassified; } field(2; "DocumentNo"; Code[20]) { Caption = 'Document No'; DataClassification = ToBeClassified; } field(3; "Customer No."; Code[20]) { TableRelation = Customer."No."; Caption = 'Customer No.'; DataClassification = ToBeClassified; } field(4; "Customer Name"; Text[250]) { FieldClass = FlowField; CalcFormula = lookup(Customer.Name where("No." = field("Customer No."))); Caption = 'Customer Name'; } field(5; "VM Person Responsible"; Code[20]) { TableRelation = "Salesperson/Purchaser".Code; Caption = 'VM Person Responsible'; DataClassification = ToBeClassified; } field(6; Decision; Enum DecisionEnum) { Caption = 'Decision'; DataClassification = ToBeClassified; } field(7; DeclineReason; Text[2048]) { Caption = 'Decline Reason'; DataClassification = ToBeClassified; } field(8; DeclineCode; Enum DeclineReasonEnum) { Caption = 'Decline Code'; DataClassification = ToBeClassified; InitValue = Blank; } field(9; ShipmentMethod; Code[20]) { Caption = 'Shipment Method'; DataClassification = ToBeClassified; } field(10; AllItemsInStock; Boolean) { Caption = 'All Items In Stock'; DataClassification = ToBeClassified; } field(11; NoOfQuotes; Integer) { Caption = 'No Of. Quotes'; DataClassification = ToBeClassified; } field(12; "DocumentNoSeries"; Code[20]) { Caption = 'Document No. Series'; Editable = false; TableRelation = "No. Series"; } field(13; "RFQRefNo"; Text[50]) { Caption = 'RFQ Reference no.'; DataClassification = ToBeClassified; } field(14; DocumentsProcessed; Boolean) { Caption = 'Processed'; DataClassification = ToBeClassified; } field(15; "BuyertnId"; Text[50]) { DataClassification = ToBeClassified; } field(16; "BuyerName"; Text[50]) { DataClassification = ToBeClassified; } field(17; "BuyerContactEmail"; Text[128]) { DataClassification = ToBeClassified; } field(18; "BuyerContactName"; Text[80]) { DataClassification = ToBeClassified; } field(19; CustomerAutoIdentified; Boolean) { DataClassification = ToBeClassified; } field(20; isDeclined; Boolean) { DataClassification = ToBeClassified; } field(21; DocumentId; Text[40]) { DataClassification = ToBeClassified; } field(22; EntryNo; Integer) { DataClassification = ToBeClassified; AutoIncrement = true; } } keys { key(PK; EntryNo) { Clustered = true; } } trigger OnInsert() var begin end; trigger OnModify() begin end; trigger OnDelete() begin end; trigger OnRename() begin end; }
Integration Header - List Part
page 50104 IntegrationHdr { ApplicationArea = All; Caption = 'ShipServ Integration Header'; PageType = ListPart; SourceTable = IntegrationHdr; UsageCategory = Administration; //DataCaptionFields = DocumentNo, "Customer No."; layout { area(content) { repeater(General) { field(EntryNo; Rec.EntryNo) { ApplicationArea = all; } field(DocumentId; Rec.DocumentId) { ApplicationArea = all; } field(DocumentNo; Rec.DocumentNo) { Caption = 'Document No.'; } field("Customer No."; Rec."Customer No.") { Caption = 'Customer No.'; ToolTip = 'Specifies the Customer No. in Business Central.'; } field("Customer Name"; Rec."Customer Name") { Caption = 'Customer Name'; ToolTip = 'Specifies the Customer Name in Business Central..'; Editable = false; } field("VM Person Responsible"; Rec."VM Person Responsible") { Caption = 'VM Person Responsible'; ToolTip = 'Specifies the Customer Person Responsible.'; Editable = false; } field(Decision; Rec.Decision) { Caption = 'Decision'; ToolTip = 'Specifies the Decision taken'; } field(DeclineCode; Rec.DeclineCode) { Caption = 'Decline Code'; ToolTip = 'Specifies the Decline Code'; } field(DeclineReason; Rec.DeclineReason) { Caption = 'Decline Reason'; ToolTip = 'Specifies the Decline Reason.'; ShowMandatory = Rec.isDeclined; } field(ShipmentMethod; Rec.ShipmentMethod) { Caption = 'Shipment Method'; ToolTip = 'Specifies the Shipment Method.'; } field(NoOfQuotes; Rec.NoOfQuotes) { Caption = 'No. Of Quotes'; ToolTip = 'Specifies the No Of. Quotes created from this RFQ.'; Editable = false; } field(AllItemsInStock; Rec.AllItemsInStock) { Caption = 'All Items In Stock'; ToolTip = 'Specifies whether all items are in stock.'; Editable = false; } field(DocumentsProcessed; Rec.DocumentsProcessed) { Caption = 'Processed'; Editable = false; } } } } actions { area(Processing) { group("RFQS") { action("Process RFQs") { trigger OnAction() var begin end; } } } } }
Integration Header Lines List Part
page 50105 IntegrationLine { ApplicationArea = All; Caption = 'IntegrationLine'; PageType = ListPart; SourceTable = IntegrationLine; layout { area(content) { repeater(General) { field(EntryNo; Rec.EntryNo) { ApplicationArea = all; } field(HeaderEntryNo; Rec.HeaderEntryNo) { ApplicationArea = all; } field(ItemNo; Rec.ItemNo) { ToolTip = 'Specifies the value of the Item No. from '; } field(ItemNo; Rec.ItemNo) { ToolTip = 'Specifies the value of the ItemNo field.'; } field(CrossReferenceNo; Rec.CrossReferenceNo) { ToolTip = 'Specifies the value of the CrossReferenceNo field.'; } field(Description; Rec.Description) { ToolTip = 'Specifies the value of the Description field.'; } field(LineDescription; Rec.LineDescription) { ToolTip = 'Specifies the value of the line description in '; } field(Quantity; Rec.Quantity) { ToolTip = 'Specifies the value of the Quantity field.'; } field(UOM; Rec.UOM) { ToolTip = 'Specifies the value of the UOM field.'; } field(Comment; Rec.Comment) { ToolTip = 'Specifies the value of the Comment field.'; Editable = false; } field(VendorNo; Rec.VendorNo) { ToolTip = 'Specifies the value of the VendorNo field.'; } field(Model; Rec.Model) { ToolTip = 'Specifies the value of the Model field.'; } field(SerialNo; Rec.SerialNo) { ToolTip = 'Specifies the value of the SerialNo field.'; } field(Decline; Rec.Decline) { ToolTip = 'Specifies the value of the SerialNo field.'; } field(DeclineComment; Rec.DeclineComment) { ToolTip = 'Specifies the value of the SerialNo field.'; } } } } }
How I display the List parts in one page is in the original post question.
I have removed all triggers and procedures to make sure there is no interferences.
It's worth noticing that when I click to open the page, the message is instant i.e. there is no loading time whatsoever. Debugging the session doesn't break anywhere.
I also have another two tables and list part pages with the exact same logic (but different names) and they work fine as per below, so the issue is strictly related to these tables/pages.
Also, we cannot go for the traditional Document Card page (for example like Sales order) because it does not fit the client's requirements. The idea to use 2 List parts is so that the user can see all information in one screen and the List Parts work dynamically together in a way that when I click on a header (top list part), the lines are dynamically filtered (bottom list part).
Thanks for your help!
Hi,
No need to add header page as a Part, See any standard document page ID 42, and get an idea how you can add header and Line in document page.
Are there any trigger code on the tables that the data items for the page?
Maybe there is a trigger that is running into a loop.
Have you tried debugging?
There could be several reasons why your page is crashing when data is inserted. Here are a few things to consider:
Server overload: If the page is hosted on a shared server or if the server is not powerful enough, it could cause a crash when too many requests are made at once. You can try upgrading your hosting plan or switching to a dedicated server to solve this issue.
Code error: Check your code for any syntax or logic errors that could be causing the crash. It's also possible that the code is not optimized for handling large amounts of data. In this case, you may need to optimize your code or use a different approach to handle the data.
Database issues: If you're inserting data into a database, there could be issues with the database connection or with the database itself. Make sure the database is configured properly and that you're using the correct credentials to access it. You can also try optimizing your database or using a different database management system.
Network issues: It's possible that there are issues with the network or internet connection, which could cause the page like to crash when data is inserted. Make sure that your network connection is stable and that there are no issues with the internet service provider.
Memory allocation: If the amount of data being inserted is too large for the server or the page, it could cause a crash. You may need to optimize your code or increase the memory allocation for the page to handle the data.
Hardware limitations: If the server or computer does not have enough resources to handle the data, it could cause a crash. You can try upgrading the hardware or using a different server or computer that has more resources.
Hi Y_A,
Based on the information you provide, its difficult to point the exact cause of the issue. Can you please provide more information or show the code for the tables so that we can better understand what you're trying to achieve?
If you're trying to create a parent-child relationship, you might want to add another key in the line table for referencing the header record when there are multiple line records for one header record.
Also, I noticed that you're using both list parts to display the data. Have you tried using a list page and card page with a card part page for the line table? Another option would be a document type page that displays the header information and a sub page which displays the related line info.
Regards
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156