olap_query()

Read(2609) Label: query, multidimensional database,

Description:

Query data in a multidimensional database and return the result.

Syntax:

olap_query(conn,mdx)

Note:

This external library function (See External Library Guide) queries data from a multidimensional database and returns the result.

Option:

@c

Return a cursor

Parameter:

conn

The connection object

mdx

A multidimensional database query that allows one or two axes

Return value:

A table sequence or a cursor

Example:

 

A

 

1

=olap_open("http://192.168.0.178:8088/msmdpump.dll","CubeTest","Administrator","admin")

Connect to the multidimensional database named CubeTest.

2

=olap_query(A1," select {[Measures].[OrderAmount]} on columns from [DataSourceMulti]")

Find out total sales amount.

3

=olap_query@c(A1," with member [Measures].[AnnualInterestRate] as

'[Measures].[SalesAmount]/[Measures].[StandardCost]-1'

select{[Measures].[SalesAmount],[Measures].[StandardCost],[Measures].[ AnnualInterestRate]} on columns,

{[Order Date].[Calendar Year].[Calendar Year]} on rows

from [DataSourceMulti]")

Find out each year’s sales amount and standard cost and calculate the annual interest rate, and return result as a cursor.

4

=A4.fetch(5)

 

5

>olap_close(A1)

Close connection to the dimensional database.

Related function:

olap_close()

olap_open()