Листинг 8
// Добавим имя куба в определение источника данных
ConnStr := ‘OLEDB;Provider=MSOLAP; Initial Catalog=[OCWCube];
‘+
‘Data Source=’+ SaveDialog1.FileName + ‘; ‘+
// Предложение CREATE CUBE
‘CreateCube=CREATE CUBE [OCWCube] (‘+
‘DIMENSION [Country], ‘+
‘LEVEL [All] TYPE ALL, LEVEL [Country], LEVEL [City], ‘+
‘LEVEL [CompanyName],’+
‘DIMENSION [CompanyName1], ‘+
‘LEVEL [All] TYPE ALL, LEVEL [CompanyName1],’+
‘DIMENSION [Salesperson], ‘+
‘LEVEL [All] TYPE ALL, LEVEL [Salesperson], ‘+
‘DIMENSION [ProductName], ‘+
‘LEVEL [All] TYPE ALL, LEVEL [ProductName], ‘+
‘DIMENSION [OrderDate] TYPE TIME, ‘+
‘LEVEL [All] TYPE ALL, LEVEL [Year] TYPE YEAR, ‘+
‘LEVEL [Month] TYPE MONTH, ‘+
‘MEASURE [ExtendedPrice] FUNCTION SUM); ‘+
// Предложение INSERT INTO
‘InsertInto=INSERT INTO OCWCube([Country].[Country], [City],
‘ +
‘[CompanyName], [ProductName].[ProductName], ‘ +
‘[CompanyName1].[CompanyName1],[Salesperson].[Salesperson],’+
‘[OrderDate],[ExtendedPrice], [CompanyName].[CompanyName] ) ‘+
‘OPTIONS ATTEMPT_ANALYSIS ‘+
// Запрос на выборку фактических данных
‘SELECT Invoices.Country, Invoices.City, ‘+
‘Invoices.Customers.CompanyName, Invoices.ProductName, ‘+
‘Invoices.Shippers.CompanyName, Invoices.Salesperson, ‘+
‘Invoices.OrderDate,Invoices.ExtendedPrice ‘+
‘FROM Invoices; Source_DSN=”DSN=’+ODBC_DSN+’”’;