
Hello all,
Currently, we have a known issue in v16.x (on-premises only) where filtering on a List page does not update the PowerBI Report Factbox correctly i.e. the filtering is broken. The team is investigating the underlying cause, but you can apply the following workaround in the meantime.
Your custom PowerBI Reports remains the same, (just make sure the Primary Key is in the “Filter on all pages” section).
The workaround is in the AL code and you will have to add the following code in triggers OnAfterGetCurrRecord() and OnOpenPage().
Below is a sample of a page extension for Items List:
Once you publish the page extension successfully, on the Items page select your PowerBI Report in the Factbox and the filtering should work again:
“Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures.”
*This post is locked for comments
I have the same question (0)Here is the sample extension code:
pageextension 50100 ItemListExt extends "Item List"
{
layout
{
addfirst(FactBoxes)
{
part("Item List"; "Power BI Report FactBox")
{
ApplicationArea = All;
}
}
}
trigger OnAfterGetCurrRecord()
begin
CurrPage."Item List".PAGE.SetCurrentListSelection(
"No.", // This is the value to set the filter to (OnAfterGetCurrRecord is called every time a different record is selected)
false, // This represents whether the value in the line above is an integer or not. For example, in this case it is a Code, which is not an integer.
true // This represents whether the factbox is visible or not and is used only for optimization. I suggest always passing true here.
);
end;
trigger OnOpenPage()
var
FactBoxVisible: Boolean;
begin
CurrPage."Item List".PAGE.InitFactBox(
CurrPage.ObjectId(false) '_custom', // This is what we call "Context". Factboxes loaded with the same Context will show the same reports. This allows 1) to show the same set of reports in different pages, or 2) to show two different sets of reports in the same page.
CurrPage.Caption, // This is the filter applied when the user chooses the action "Select Reports". Leave it empty to show all reports.
FactBoxVisible // FactBoxVisible returns whether the factbox has been previously hidden by using: CurrPage.MyCustomPowerBIPart.PAGE.SetFactBoxVisibility(PowerBIVisible); This is a feature that we will soon deprecate, so I suggess to just always pass true here.
);
end;
}