News combit Dev Blog

Brand-New Component: „combit.ReportServer.ClientApi“

Posted: Tuesday, October 24, 2017 | 0 comment(s)
 
Have you ever wanted to migrate your List & Label projects and data providers to a central webserver to export and view them on an Android or iOS tablet with just a few lines of code? With the upconing new version 23 we have some good news for you!

Our stand-alone server reporting solution combit Report Server (included with List & Label Enterprise Edition) has already provided an easy way for the integration with your own applications via its REST API for some years. The new combit.ReportServer.ClientApi assembly, which comes with version 23, enables you to use many (new) functions of the Report Server API with not more than a few simple lines of C#/VB.NET code. All HTTP communication is managed internally so using the REST API just became as easy as using any regular .NET library. The functions comprise the export of reports, uploading new report projects, creating new data sources, managing the server and more.

Introducing all functions of the new assembly would go way beyond the scope of this introductory blog post, so let us focus on one tiny code example to show you how easy it has become to get a report from the server. Note that nearly all features are demonstrated in the extensive sample project that comes with the new assembly. Imagine an app like the one you might have developed already with List & Label: We want to present a list of all available reports to the user and save the selected report as a PDF file. With combit Report Server, the project files and data sources are managed on the central server, so the first step is to load a list of the available projects:


Before we can do that, we of course have to authenticate & connect to the Report Server:

var options = new ClientOptions()
{
    Authentication = new ApiTokenAuthentication("ApiClient123", "XXXXXXXX")
};

var serverUrl = "http://localhost/combitReportServer";
var reportServer = await ReportServer.ConnectAsync(serverUrl, options);


After establishing the connection to the server, we can ask the server for a list of all report templates available to fill the ListBox:

var reportTemplates = await reportServer.ReportTemplates.GetAllAsync();
foreach (ReportTemplate report in reportTemplates)
{
    listBox.Items.Add(report);
}


Once the user hits the button, we may prepare the export (e.g. define some report parameters) and let the server export the PDF file.

var selectedReport = (ReportTemplate)listBox.SelectedItem;

// Prepare the export on the client
var preparedExport = reportServer.Exporter.PrepareExport(selectedReport.Id);
preparedExport.ReportParameters.Add("Year", 2017);

// Send the export job to the server
var exportResult = await preparedExport.ExportAsync();


The only remaining task is to download the created PDF file to the client.

await exportResult.DownloadFilesAsync(@"C:\Reports");


That was easy:


Want some icing on the cake? The combit.ReportServer.ClientApi assembly is

  • platform-independent,
  • compatible with both .NET Classic and .NET Core (built against .NET Standard 1.3),
  • fully supports the use of async/await and
  • comes with an extensive C# sample project and a comprehensive documentation.

 
If you would like to migrate existing List & Label projects and their data sources of your own application to the Report Server automatically for the report to be accessible from all major operating systems, web browsers and devices, we have a second new assembly for you: combit.ListLabel.ReportServerIntegration.

This library provides helper methods for uploading List & Label projects and their dependencies (e.g. images, drilldown projects) and creating data sources on the server from the data providers you know from List & Label. The mentioned sample project demonstrates these features, too.




Tags: .NET, API, List & Label 23, LL 23 Feature Preview, Report Server Feature Preview, REST API

Author: Lukas Eckert
Software Developer

Lukas Eckert is a software developer working mainly on combit's reporting products. He joined our team while completing his BS in Applied Computer Science. In his spare time the seasoned traveller enjoys mountaineering in the Swiss Alps closeby.




RSS
combit Development BlogRSS
What’s this blog for?
A place to share updates about the ongoing development of our products. General musings on the software industry included.
Archive
April 2021 (1)
March 2021 (1)
February 2021 (2)
January 2021 (1)
December 2020 (2)
November 2020 (1)
October 2020 (2)
September 2020 (1)
August 2020 (2)
July 2020 (1)
June 2020 (1)
May 2020 (2)
April 2020 (2)
March 2020 (2)
February 2020 (1)
January 2020 (1)
December 2019 (1)
November 2019 (2)
October 2019 (2)
September 2019 (2)
August 2019 (2)
July 2019 (2)
June 2019 (2)
May 2019 (1)
April 2019 (0)
April 2019 (1)
March 2019 (1)
February 2019 (1)
January 2019 (1)
December 2018 (1)
November 2018 (2)
October 2018 (4)
September 2018 (4)
August 2018 (2)
July 2018 (2)
June 2018 (2)
May 2018 (1)
April 2018 (1)
March 2018 (1)
February 2018 (2)
January 2018 (1)
December 2017 (1)
November 2017 (2)
October 2017 (3)
September 2017 (3)
August 2017 (2)
July 2017 (2)
June 2017 (1)
May 2017 (2)
April 2017 (1)
March 2017 (1)
February 2017 (1)
January 2017 (2)
December 2016 (1)
November 2016 (1)
October 2016 (4)
September 2016 (5)
August 2016 (2)
July 2016 (2)
June 2016 (3)
May 2016 (2)
April 2016 (3)
March 2016 (3)
February 2016 (1)
January 2016 (2)
December 2015 (2)
November 2015 (1)
October 2015 (4)
September 2015 (5)
August 2015 (2)
July 2015 (2)
June 2015 (2)
May 2015 (1)
April 2015 (2)
March 2015 (1)
February 2015 (1)
January 2015 (1)
December 2014 (2)
November 2014 (1)
October 2014 (1)
September 2014 (2)
August 2014 (1)
July 2014 (2)
June 2014 (1)
May 2014 (2)
April 2014 (1)
March 2014 (2)
+1 800 256 3608 (toll-free North America only)