-1

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.

CliveMM
  • 21
  • 2

1 Answers1

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
    }
};
Andrey Nikolov
  • 12,967
  • 3
  • 20
  • 32