Last week, we wrote how to configure the front-end of Ranet OLAP Pivot Table for HTML. Now, let’s talk about overriding the backend of the solution.

Ranet OLAP Pivot Table provides API for working with the server code. WebApi controllers are an intermediate link between our client code and data providers (Oracle Hyperion Essbase, Microsoft Analysis Services, Pentaho Mondrian, and IBM TM1). Figure 1 shows our solution pattern.

ranet html pivot table solution patterm

Figure 1. Ranet HTML Pivot Table solution pattern

 

Each of our WebApi controllers can be overridden in your application.

We will show an example of overriding the logic of the controller responsible for working with the data. We already wrote how to integrate Ranet in an ASP.NET application, so let’s start right with overriding the logic. To do this, we have to create CustomDirectRouteProvider class (Figures 2 and 3).

CustomDirectRouteProvider class

Figure 2. CustomDirectRouteProvider class in the project

 

CustomDirectRouteProvider class 2

Figure 3. CustomDirectRouteProvider class

 

Then communicate CustomDirectRouteProvider to the WebAPI. In order to do this, we have to modify WebApiConfig class (Figure 4).

Overriding default route provider

Figure 4. Overriding default route provider

 

Create WebAPI controller in the project, which will interact with the front-end of our solution when data is required. Now create CustomDataSourceController class in the Controllers folder of the solution (Figures 5, 6, and 7).

ranet pivot table WebAPI controller

Figure 5. Creating WebAPI controller

 

WebAPI controller

Figure 6. Creating WebAPI controller

 

CustomDataSourceController class

Figure 7. CustomDataSourceController class in the project

 

After we have created our data provider, we would like to override only some methods of the initial controller. We have to inherit our new provider from the initial one and override the method where we will be able to filter the cubes, which will be the basis of the end users’ reports.

cube filtering code

Figure 8. Cube filtering code for cubes that will be the basis of the end users’ reports

 

ranet pivot table getting cubes

Figure 9. The process of getting cubes that will be the basis of the end users’ reports

 

Let’s consider a more complicated scenario where we’d like to filter the pivot table data in the application. In this case, we’ll have to create a query to retrieve the data.

First, create a simple report (Figure 10).

ranet olap report

Figure 10. A new report

 

Let’s say, we do not want to display data about certain categories of goods to certain users. To do this, we have to override GetQueryBuilderParameters method where we'll set SubCube property for the return parameter, which will be integrated into the end query run to retrieve data for the pivot table (Figure 11).

ranet html pivot table overring method

Figure 11. Overriding the method to get parameters for query generation

 

Let’s open the same report once again and look at the data in the pivot table. As Figure 12 clearly shows, the data about Accessories and Components has been excluded from the report.

olap report with Subcube

Figure 12. Report with the SubCube property applied

 

We hope you found this post helpful.
If you still have any questions about using our Ranet OLAP Pivot Table API, feel free to ask us questions in the comments section.