Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

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

(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;
}
  • Suggested answer
    Using FilterPageBuilder to filter records as an input to a query - is it possible
    Many thanks ZHU,
     
    I was hoping there may have been a way to use the temp table containing the Invoice(s) number that my FilterPageBuilder creates and then use these to filter on the query to restrict the records. Perhaps an idea for further research / development at a later time :)
     
    Cheers
    Stephen
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 76,064 Super User 2024 Season 2 on at
    Using FilterPageBuilder to filter records as an input to a query - is it possible
    Hi, as far as I know this can't be done. Only tables can be added.
    So it is recommended to create a report to do it.
     
    Hope this helps.
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans