How to integrate Power BI in a Delphi desktop application

限于喜欢 提交于 2019-12-14 03:36:06

问题


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.

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.


回答1:


I'm integrating it in WPF C# application. It's pretty much the same as in Delphi, but easier due to availability of ADAL library for C#.

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.

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
}

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
    }
};


来源:https://stackoverflow.com/questions/56738739/how-to-integrate-power-bi-in-a-delphi-desktop-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!