This topic explains, in both conceptual and step-by-step form, how to add the igOlapXmlaDataSource
™ component to an ASP.NET MVC application using the ASP.NET MVC helper.
The following topics are prerequisites to understanding this topic:
igOlapXmlaDataSource Overview: This topic provides conceptual information about the igOlapXmlaDataSource
component including its main features, minimum requirements, and user functionality.
Adding igOlapXmlaDataSource to an HTML Page: This topic explains, in both conceptual and step-by-step form, how to add the igOlapXmlaDataSource
component to an HTML page.
This topic contains the following sections:
The igOlapXmlaDataSource
is a client-side component accompanied by an ASP.NET MVC helper that allows the component to be used in the CS/VB code of an MVC View. The ASP.NET MVC helper is the same for igOlapXmlaDataSource
and igOlapFlatDataSource
component and, depending on the options you set, an instance of the respective data source is created on the client. When using the helper, you provide it with an identifier that enables it to be used in one or more components capable of visualizing its data (igPivotDataSelector
™, igPivotGrid
™, igPivotView
™).
Defining the igOlapXmlaDataSource
in the View is achieved by setting the required properties using methods that always return the same object that called them. This allows chaining syntax to be used for setting all required properties. For complex objects such as DataSourceOptions, lambda expression builders are used in order to achieve this kind of syntax.
Following are the general requirements for adding igOlapXmlaDataSource
to an ASP.NET MVC application:
Following are the general conceptual steps for adding igOlapXmlaDataSource
to an ASP.NET MVC application.
Adding the Infragistics namespace
Loading the required JavaScript resources
Adding the igOlapXmlaDataSource
The procedure below demonstrates how to add the igOlapXmlaDataSource
component to an ASP.NET MVC application. The required resources in this example are referred to automatically with the Infragistics Loader.
To complete the procedure, you need the following:
Infragistics.Web.Mvc.dll
assembly added to the application projectThe following steps demonstrate how to add an igOlapXmlaDataSource
to an ASP.NET MVC application.
Add the Infragistics namespace.
Add the Infragistics.Web.Mvc namespace to your View code.
In ASPX:
<%=Import Namespace=”Infragistics.Web.Mvc” %>
Add a reference to the Infragistics namespace.
Add script reference to the Infragistics Loader component.
Add the following script reference to the head section of the View.
In ASPX:
<script src="[path to js folder]/infragistics.loader.js"></script>
Add the definition of the Infragistics Loader.
The following code loads the required resources using the Infragistics Loader.
In ASPX:
<%=Html.Infragistics()
.Loader()
.ScriptPath("[js path]")
.CssPath("[css path]")
.Render()
%>
Add the igOlapXmlaDataSource
component.
Add the igOlapXmlaDataSource
declaration setting the ID.
Add the declaration to the code of the View:
In ASPX:
<%=Html.Infragistics().OlapDataSource().ID("xmlaDataSource")
// remaining code goes here
%>
(Optional) Configure the common OLAP data source properties.
Use the DataSourceOptions method to set the properties that are common for both multidimensional (OLAP) data sources, e.g. columns, rows, measures.
In ASPX:
<%=Html.Infragistics().OlapDataSource().ID("xmlaDataSource")
.DataSourceOptions(dataSourceOptions => dataSourceOptions
.Columns("[Product].[Product Categories]")
.Rows("[Sales Territory].[Sales Territory]")
.Measures("[Measures].[Internet Order Count]"))
%>
Configure the igOlapXmlaDataSource-specific properties.
Of all igOlapXmlaDataSource -specific properties, the ServerUrl property of the XmlaOptions object is required.
In ASPX:
<%=Html.Infragistics().OlapDataSource().ID("xmlaDataSource")
.DataSourceOptions(dataSourceOptions => dataSourceOptions
// common properties
.XmlaOptions(xmlaOptions => xmlaOptions
.ServerUrl("http://sampledata.infragistics.com/olap/msmdpump.dll")
.Catalog("Adventure Works DW Standard Edition")
.Cube("Adventure Works")
.MeasureGroup("Internet Sales")
))
%>
Render the JavaScript code.
To render the JavaScript code according to the setup that you provided, call the Render method.
In ASPX:
<%= Html.Infragistics().OlapDataSource().ID("xmlaDataSource")
// all options
.Render()
%>
At this point, you can use the ID which you set to the OlapDataSource definition, in order to use the data source component instance in pivot-grid-related controls like igPivotDataSelector, igPivotGrid, and igPivotView.
Following is the complete code of this procedure.
In ASPX:
<%= Html.Infragistics().OlapDataSource().ID("xmlaDataSource")
.DataSourceOptions(dataSourceOptions => dataSourceOptions
.Columns("[Product].[Product Categories]")
.Rows("[Sales Territory].[Sales Territory]")
.Measures("[Measures].[Internet Order Count]")
.XmlaOptions(xmlaOptions => xmlaOptions
.ServerUrl("http://sampledata.infragistics.com/olap/msmdpump.dll")
.Catalog("Adventure Works DW Standard Edition")
.Cube("Adventure Works")
.MeasureGroup("Internet Sales")
)).Render()
%>
The following topics provide additional information related to this topic.
Adding igPivotDataSelector to an ASP.NET MVC Application: This topic explains, in both conceptual and step-by-step form, how to add the igPivotDataSelector
control to an ASP.NET MVC application using the ASP.NET MVC helper.
Adding igPivotGrid to an ASP.NET MVC Application: This topic explains, in both conceptual and step-by-step form, how to add the igPivotGrid
control to an ASP.NET MVC application using the ASP.NET MVC helper.
Adding igPivotView to an ASP.NET MVC Application: This topic explains, in both conceptual and step-by-step form, how to add the igPivotView
control to an ASP.NET MVC View using the ASP.NET MVC helper.
The following samples provide additional information related to this topic.
igOlapXmlaDataSource
and how to use this data source in igPivotDataSelector
and igPivotGrid
.View on GitHub