Before designing the report it is necessary to specify what data you will be working on and which the connection mechanism will be.
This tutorial builds a report using data stored in an O3 cube.
Extraction of these data is performed in 2 steps:
- Define the data source
- Define the data set.
You may have several data sets defined on the same data source.
Defining a Data Source
- Select New Data Source in the Data menu to create a new data source.
- Choose the Data Source type for O3 ( O3 Data Source)
This lets you define a data source for O3 cubes and views. These O3 data sources may be of two types:- Sources that access views saved in the server.
- Sources that access cubes saved in the server and use MDX language to specify the query.
- Indicate the Data Source Name.
In this example the data source will be called "O3 Local" - Enter the Data source parameters.
Host Name:
The name or IP address of the server where O3 is running.
In our case:localhostPort:
Server port indicated in the parameter above where O3 server is run.
In our case we will use port 7777 by default.User Name:
Name of the user defined in O3 that will be used for connection to the server.
In our case, we will use userPassword:
Password of the user defined in the previous field.
In our case we will use the user's password.Query Type:
It indicates the Data Source Type to be used: MDX Query or O3 View.
In our case O3 View - Check the connection was properly by pressing the Test Connection button*.*
Defining a Data set
Once the Data Source has been defined, you may define the Data Sets to be obtained from such source. Each Data Set will be a different query which, as mentioned before, may be generated from a view or through MDX
Whatever the case, the creation of the Data Set is the same.
For the specific case in this tutorial a view on the wines cube is used, as seen in the image below.
In this view, measures Litres Sold (Litros Vendidos) and Net Sales ( Venta Neta) are selected as columns, and dimensions Salespeople (Vendedores) and Wines( Vinos) in their corresponding levels Salesperson and Wine, are placed on the vertical axis.
Once the view has been defined and saved in the server under the name VinosPorVendedor to be used by general public the following steps must be followed:
- Select Data Set from the Data menu.
- Indicate the Data Set Name
- Select the Data Source in which the Data Set needs to be defined.
In this example, the data source is called "O3 Local". - Select O3 Data Set as Data Set Type
- In the new Data Set definition window, enter the query shown below to obtain the data displayed in the public view WinesPerSalesman. This view must have been created beforehand in the O3 Server.
In the query, it is important to point out the clause FROM in the clause referring to 'Vinos/VinosPorVendedor#_public'. This is the name by which we refer to the necessary view for this report.Vinos
This is the name of the cube just as it is published in the server.
VinosPorVendedor
The name of the view where data is extracted from.
#_public
It indicates the view is a public one.
- Presionar el botón Finish para aceptar los cambios
- La ventana que se muestra a continuación permite modificar parámetros adicionales del Conjunto de Datos, así como obtener una Vista Preliminar (Preview Results) de la consulta
Definiendo Conjuntos de Datos a través de MDX
Los pasos anteriores permitieron definir un Conjunto de Datos utilizando una vista previamente almacenada en el servidor.
O3 permite un método alternativo que no requiere salvar ninguna vista, sino que por el contrario permite al diseñador del reporte indicar la consulta directamente en el propio reporte.
Este método alternativo utiliza el lenguaje de consulta MDX, el cual permite especificar consultas multidimensionales sobre los cubos publicados en el servidor de O3
- Crear una nueva fuente de datos (Data Source) llamada O3 Local MDX con los siguientes parámetros
Host Name:
localhost
Port:
7777
User Name:
user
Password:
user
Query Type:
MDX Query
- Crear un nuevo conjunto de datos (Data Set) llamado Ventas MDX con los siguientes parámetros
Name:
Ventas MDX
Data Source:
O3 Local MDX
Data Set Type:
O3 Data Set
- Ingresar la siguiente consulta MDX para este nuevo conjunto de datos
SELECT {[Measures].[Litros Vendidos], [Measures].[Venta Neta]} ON COLUMNS ,CROSSJOIN({[Vendedores].[Vendedor].members}, {[Vinos].[Vino].members}) ON ROWS FROM [Vinos]
En esta consulta se genera una tabla de datos que contendrá:
- Una fila por cada Vino vendido por cada Distribuidor
- Para cada combinación de Vino con Distribuidor mostrará 2 columnas (las medidas Litros Vendidos y Venta Neta)
Distribuidor |
Vino |
Litros Vendidos |
Venta Neta |
---|---|---|---|
Distribuidor 1 |
Vino 1 |
10 |
1500 |
Distribuidor 1 |
Vino 2 |
15 |
2700 |
Distribuidor 2 |
Vino 1 |
13 |
1780 |
... |
... |
... |
... |
Distribuidor 3 |
Vino 3 |
12 |
720 |
La cláusula CROSSJOIN de la consulta es la que permite lograr la anidación de las dimensiones de Distribuidores y Vinos que también existía en la Vista.
Por más detalles acerca de la sintaxis y las opciones que brinda el lenguaje MDX soportado por O3 referirse a Escribiendo consultas MDX