Power Bi API: Get Power BI datasource data - c#

I would like to know whether it's possible to get hold of the data associated with a specific report. This also includes the schema of the data. In other words, if the report makes use of an Excel file, I would like to get hold of the data in that Excel file. Is something like this even possible? I have tried some of the methods, like GetDatasetAsync as well as GetDatasourcesAsAdminWithHttpMessagesAsync, but it did not provide the desired result.
Any assistance is greatly appreciated.
Thanks!

Here are the options I know of:
You can publish a PowerBI dataset and have other reports connect to it. You can find it on the list of connectors.
Exporting the data from the report (as csv). This only applies to the current visual.
You can export visual via PDF or PowerPoint.
XLMA Endpoints can let you query the model and retrieve what you want programmatically however this is a PREMIUM feature only. Here is a how-to.
You can build your model in analysis services (SSAS) and have a live connection to the tabular model, then you can work with the data in SSAS using XLMA.
That is about as good as it get's.

Related

Fill and Print Template C#

I am developing an application using C# which is simply the user inputs data, it is saved in a db (which is not SQL Server but MySql) and then prints it.
At this stage the user gave me a template which has the logo and some company information on top, in the middle the lines i need to fill and on the bottom some other information regarding this company.
Is it possible to open this document fill the required lines and print it using c#?
Sorry i cannot provide anything but i am stuck here and can't seem to figure out from where to start?
Thanks & Regards
Do you have access to any kind of reporting ie.Crystal Reports or SQL Server Reporting Services. You have one of 2 options, either you need to write a report that mimics his template using one of the technologies above, or you would need to use interops to access MSWord or MSExcel and do it that way. You may be able to use some third party PDF software.
If this was my project I would go the report route.

How to design report at run time SSRS

most of the time we point store procedure or table and then SSRS report designer show us field and we just drag drop those field on to report designer surface. after all we call those report programmatically and pass parameter and report shown on report viewer.
now my company want that customer will customize the report who will see the report. they want to display all the fields in a form and just customer will select each field and place on report designer surface and give some input like filter condition like date range or employee id etc and report will be shown. also at run time if customer want they can add text or move existing field etc.
i do not have any idea how could i do this with SSRS. if this is possible with SSRS then please guide me in such a way as a result i can start the job or if possible give me few relevant url of that kind from where i can get the idea. thanks
SSRS is capable of reading reports generated on-the-fly, but they have to be made just right. SSRS reports are XML documents that specify the data structure and report object structures and how the two are related. Using Visual Studio, you can use certain classes to create the XML document which is then read & filled with data on the server, then exported to the client as a standard webpage.
Here is a link to a tutorial. This should be a good starting point.
Here is a small but working example of generating RDL on-the-fly with some useful links to MSDN documentation: "How to dynamically generate SSRS Report in Code"
Hope it helps!

Display a table from Excel as html table - c# asp.net

I have an Excel file with a formatted table. Right now I have a database in sql server, I'm pulling the data into my c# asp.net program. I want to know if anyone has an idea of what I should try to use that Excel format to display data from a query at a webpage without having to go in and construct the table from scratch. I tried looking for a good tutorial on how to import an excel file and use it as a template for crystal reports, had no luck. Any advice would be greatly appreciated!
I have used a third party component called ASPOSE.NET to acheive this. ASPOSE provides extensive formatting options and support a wide variety of file formats.
However it is not a free product.

Programmatically Exporting Reports via SSRS API

I have a custom interface where my users select multiple reports and export them all at once. I need to programatically export these reports and preferably offer all the same format options. I understand this can be done through the SSRS API. Does anyone already know how to do this to save me some research time?
Many thanks...
Looks like you would use the ReportExecutionService class - not the management API, which is where I was looking at first.
Use the Render method to generate the report. Pay attention to those first two parameters of Render to specify the format.
Hope this helps.

Crystal Reports in Visual Studio 2005 (C# .NET Windows App)

I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 .I want to display two more field to report(not available in data base table. I want to create these field by adding some data from existing field of data base table)
If you look at the .NET API exposed by Crystal Reports, you'll find that you can inject a DataSet into a report - this gives your application full control over the data used by the report, leveraging Crystal Reports as a presentation engine.
I've used this technique to generate reports over data soures not natively supported by Crystal Reports - it also helps to ensure that all the data comes from the sames source (as the API for changing the connection used within a normal Crystal report is somewhat flakey).
So, what I'd do in your situation is to load all the required data into a DataSet, add the extra columns, and then pass the dataset into the report. Only complex bit is that you need to save out the XML schema of the dataset and import it into Crystal Reports so that it is aware of the shape of your data.
You could use a crystal function also for this. Depending on how complex the calculation is from Column A to B. The more complex the easier it becomes just to do what Bevan says and change the dataset.
If you were more specific i might be able to give you some example code.
Use CR formula field.

Categories