Skip to main content
Answered

Using FilterPageBuilder to filter records as an input to a query - is it possible

editSubscribe (0) ShareShare
ReportReport
Posted on by 8
Hi Experts,
 
I am extracting data from Posted Sales Invoices (Headers & Lines) that is displayed on a page so the users can then extract out to Excel.
 
I have set up a query that outputs to a temp file and built a new page that displays only specific fields. This all works fine.
 
What I would like to do now is filter the data based on user entered data on opening of the page, eg a range of invoice numbers, and only have this filtered data be used by the query and then output on the page. I have attempted to use FilterPageBuilder on a Page Extension of the new Page to achieve this but I am getting a /table ids do not match/ error.
 
Is what I am trying to do achievable?
 
Below is the code I have written and thanks in advance
Stephen
 
pageextension 50110 InvoiceforWarehouseFilePageExt extends /Posted Sales Invoices/
{
actions
{
addafter(/&Invoice/)
{
action(/Invoices for Warehouse File List/)
{
Caption = 'Invoices for Warehouse File';
ApplicationArea = All;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
 
trigger OnAction()
var
varFilterPageBuilder: FilterPageBuilder;
PostedInvoiceList: Record /Sales Invoice Header/;
begin
varFilterPageBuilder.AddRecord('Sales Invoice Header Table', PostedInvoiceList);
varFilterPageBuilder.Addfield('Sales Invoice Header Table', PostedInvoiceList./No./);
varFilterPageBuilder.PageCaption := 'Posted Invoices for Warehouse Filter Page';
if varFilterPageBuilder.RunModal() then begin
PostedInvoiceList.SetView(varFilterPageBuilder.GetView('Sales Invoice Header Table'));
//Page.Run(Page::/InvoicesforWarehouseFilePage/, PostedInvoiceList);
Page.Run(50100);
end;
end;
}
}
}
}
 
page 50100 /InvoicesforWarehouseFilePage/
{
Caption = 'Invoices for Warehouse File';
PageType = List;
UsageCategory = Lists;
ApplicationArea = All;
SourceTable = /InvoicesforWarehouseFileTemp/;
Editable = false;
 
layout
{
area(Content)
{
repeater(Group)
{
field(/Order Number/; Rec./DocumentNo/)
{
ApplicationArea = All;
}
field(/Ship-to-Name/; Rec./Ship-to-Name/)
{
ApplicationArea = All;
}
field(/Customer PO/; Rec./External Document No/)
{
ApplicationArea = All;
}
field(/Address 1/; Rec./Ship-to Address/)
{
ApplicationArea = All;
}
field(/Address 2/; Rec./Ship-to Address 2/)
{
ApplicationArea = All;
}
field(/Address 3/; Rec./Ship-to Address 3/)
{
ApplicationArea = All;
}
field(/Suburb/; Rec./Ship-to City/)
{
ApplicationArea = All;
}
field(/State/; Rec./Ship-to County/)
{
ApplicationArea = All;
}
field(/Postcode/; Rec./Ship-to Post Code/)
{
ApplicationArea = All;
}
field(/Contact/; Rec./Sell-to Contact/)
{
ApplicationArea = All;
}
field(/Phone/; Rec./Sell-to Phone No./)
{
ApplicationArea = All;
}
field(/Contact Email/; Rec./Sell-to E-Mail/)
{
ApplicationArea = All;
}
field(/Instructions/; Rec./Shipping Instructions/)
{
ApplicationArea = All;
}
field(/Carrier/; Rec./Shipment Method Code/)
{
ApplicationArea = All;
}
 
field(/Product Code/; Rec./Product Code/)
{
ApplicationArea = All;
}
field(/Quantity/; Rec./Quantity/)
{
ApplicationArea = All;
}
 
}
}
}
trigger OnOpenPage()
var
InvoicesforWarehouseFileQuery: Query InvoicesforWarehouseFileQuery;
begin
CurrPage.Editable(false);
if InvoicesforWarehouseFileQuery.Open() then begin
while InvoicesforWarehouseFileQuery.Read()
do begin
Rec.Init();
Rec.RowNo := Rec.RowNo + 1;
Rec.DocumentNo := InvoicesforWarehouseFileQuery.DocumentNo;
Rec./External Document No/ := InvoicesforWarehouseFileQuery.External_Document_No_;
Rec./Ship-to-Name/ := InvoicesforWarehouseFileQuery.ShiptoName;
Rec./Ship-to Address/ := InvoicesforWarehouseFileQuery.ShiptoAddress;
Rec./Ship-to Address 2/ := InvoicesforWarehouseFileQuery.ShiptoAddress2;
Rec./Ship-to Address 3/ := InvoicesforWarehouseFileQuery.ShiptoAddress3;
Rec./Ship-to City/ := InvoicesforWarehouseFileQuery.ShiptoCity;
Rec./Ship-to County/ := InvoicesforWarehouseFileQuery.ShiptoCounty;
Rec./Ship-to Post Code/ := InvoicesforWarehouseFileQuery.ShiptoPostCode;
Rec./Sell-to Contact/ := InvoicesforWarehouseFileQuery.SelltoContact;
Rec./Sell-to Phone No./ := InvoicesforWarehouseFileQuery.SelltoPhoneNo;
Rec./Sell-to E-Mail/ := InvoicesforWarehouseFileQuery.SelltoEMail;
Rec./Shipping Instructions/ := InvoicesforWarehouseFileQuery.Shipping_Instructions;
Rec./Shipment Method Code/ := InvoicesforWarehouseFileQuery.ShipmentMethodCode;
Rec./Product Code/ := InvoicesforWarehouseFileQuery.No_;
Rec./Quantity/ := InvoicesforWarehouseFileQuery.Quantity;
Rec.Insert()
end;
InvoicesforWarehouseFileQuery.Close();
end;
end;
}
Categories: