如何将Power BI集成到Delphi桌面应用程序中 [英] How to integrate Power BI in a Delphi desktop application
问题描述
任何人都可以将Microsoft Power BI集成到Delphi应用程序中。我相信我需要将网页嵌入到表单中,我对此表示满意,但是我看不到如何强制刷新或向Power BI提供运行时选择标准。
Has anyone integrated Microsoft Power BI into a Delphi application. I beleive that I will need to embed a webpage into a form,I am ok with that, however I cant see how you force a refresh or feed Power BI the run-time selection criteria.
它将链接到标准SQL Server数据库(目前不基于云)。我有要在Power BI桌面上使用的图形。
It will be linked to a standard SQL Server database (not cloud based at the moment). I have the graph I want working on Power BI desktop.
推荐答案
我将其集成到 WPF C#应用程序。它与Delphi中的几乎相同,但由于适用于C#的ADAL 库。
I'm integrating it in WPF C# application. It's pretty much the same as in Delp but easier due to availability of ADAL library for C#.
如果要基于当前选择显示报告(或图块或仪表板)在您的应用程序中,您必须将此信息提供给报告。您可以将选择内容保存到数据库中的表中(或有关选择内容的信息,例如主键值),并在此表上生成报告。将会话列放入其中,并在每次保存时生成唯一的会话ID值。然后过滤报告以仅显示您会话的数据。
If you want to display a report (or tile, or dashboard) based on the current selection from your application, you must provide this information to the report. You can save the selection to a table in the database (or information about the selection, like primary key values) and build the report on this table. Put a session column in it, and on every save generate an unique session ID value. Then filter the report to show only data for your session.
要过滤嵌入式报表,定义过滤器,并将其分配给 report.setFilters
方法。就您而言,只需 IBasicFilter
就足够了。 构建像这样:
To filter the embedded report, define a filter and assign it to filters
property of the embed configuration object, that you are passing to the JavaScript Power BI Client, or call report.setFilters
method. In your case, IBasicFilter
is enough. Construct it like this:
const basicFilter: pbi.models.IBasicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "ReportTempTableName",
column: "SessionId"
},
operator: "In",
values: [12345],
filterType: 1 // pbi.models.FilterType.BasicFilter
}
使用您要可视化的唯一会话ID值替换 12345
。
replacing 12345
with the unique session ID value, that you want to visualize.
为避免这种可能性,用户删除应用的过滤器并查看所有会话的数据,则可以隐藏过滤器窗格:
To avoid the possibility the user to remove the applied filter and see the data for all sessions, you may hide the filter pane:
var embedConfig = {
...
settings: {
filterPaneEnabled: false
}
};
这篇关于如何将Power BI集成到Delphi桌面应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!