The Exago interface consists of two elements: The User Interface and the API. The User Interface is built directly onto the .NET API. This means that .NET applications can interface directly with Exago. Non-.NET applications can interface with the REST Web Service API, which offer subsets of the .NET API.
This guide will walk through the process of integrating Exago into a .NET-based web application. We will demonstrate how to use the API to connect with an existing installation of the Exago Application, and showcase how to do some basic report management tasks.
For this example, we will load an existing report, modify its run-time filters, and then execute the report in a browser window.
First reference the Web Reports API and Puppeteer Rasterizer library. This is usually located in the <WebApp>\bin
folder, where <WebApp>
represents the install directory of the Exago Web Application. The files are named WebReportsApi.dll
and ExagoPuppeteerRasterizer.dll
.
Include the following namespaces for now:
An Api Object is the main class you need to create in order to interact with Exago. It contains the first and last points of entry for each instance of your application.
Create an Api Object using the following overloaded constructor:
Api myApi = new Api(AppPath);
AppPath
is the physical or virtual location of your Exago installation.
WebReports.xml
will be used. Now let's load the report we want to modify.
Report myReport = (Report)myApi.ReportObjectFactory.LoadFromRepository(@"TestReport");
The ReportObjectFactory class is the collection class for report management methods. This contains methods for creating, loading, copying, saving, renaming, and deleting report files. It can be used to work within a repository or a temporary browser session, or both if necessary. In this case, we're simply loading a pre-existing report into the Api.
NoteSeveral methods reference an Active report by default. This is usually the last report accessed, but can be specified by the Active property of the ReportObjectFactory.
Reports called from within the ReportObjectFactory are ReportObject objects, which is a general class representing the various report types.
We are casting the ReportObject called from the factory to a Report, because we know it is a report. Report inherits several methods from ReportObject, but greatly expands the management capabilities.
NoteTo load a Dashboard or a Chained Report, cast it to DashboardReport or ChainedReport object respectively.
Now that we have loaded and declared our Report object, we can begin to modify its contents. Let's clear out the pre-existing runtime filters, and add one of our own:
foreach (Filter oldFilter in myReport.Filters)
{ myReport.Filters.Remove(oldFilter); }
Filter myFilter = myReport.Filters.NewFilter(); myFilter.DbName = "Customers.CompanyName";
myFilter.Operator = wrFilterOperator.NotEqualTo;
myFilter.Value = "Exago Inc.";
myFilter.AndOrWithNext = wrFilterAndOrWithNext.And;
Note that all these modifications will take place within the current session, and will not modify the report definition itself unless you specifically overwrite it.
Let's execute the altered report. First, some administrative action is required.
Set the report execute type to HTML, so it runs in the browser:
myReport.ExportType = wrExportType.Html;
And hide the application tabs to avoid clutter:
myApi.ShowTabs = false;
Now save the changes we've made to the Api. This will load the report into a temporary space in the Api to prepare for execution.
myApi.ReportObjectFactory.SaveToApi(myReport);
And we're all set! Calling the following method will end the session, perform the specified action, and return the session URL. The session URL is an alphanumeric single-use identifier for the session. Append it to your Exago application URL.
Since we loaded a report into the Api, the action defaults to Execute.
string url = @"//MyDomainServer/Exago/" + myApi.GetUrlParamString(ExagoHome);
NoteThe ExagoHome parameter can be used to specify the Web Application's home page. It will default to
ExagoHome.aspx
.
Now redirect your browser to the generated URL and see the results!