且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Power BI集成到Delphi桌面应用程序中

更新时间:2023-02-07 19:23:40

我将其集成到 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.

过滤嵌入式报表,定义过滤器,并将其分配给过滤器属性github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details rel = nofollow noreferrer>嵌入配置对象,您将传递给 JavaScript Power BI客户端,或调用 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
    }
};