Customize Olap By Amo
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Customize Olap By Amo

on

  • 1,055 views

 

Statistics

Views

Total Views
1,055
Views on SlideShare
1,054
Embed Views
1

Actions

Likes
1
Downloads
20
Comments
0

1 Embed 1

https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Customize Olap By Amo Document Transcript

  • 1. Customize Project Server 2010Analysis Management ObjectVersion: 1.0Prepared by: Huynh Thi Bao ChauDate: 9/26/2011Coastal Point Solutions
  • 2. Analysis Management ObjectTable of ContentsRevision history ............................................................................................................................................. 41. Analysis Management Object (AMO) ................................................................................................... 51.1. What is AMO? ................................................................................................................................... 51.2. Architecture ...................................................................................................................................... 51.3. AMO OLAP classes ............................................................................................................................ 52. Programming AMO OLAP Basic Objects ............................................................................................... 72.1. Dimension Objects ............................................................................................................................ 7 Creating, Dropping, and Finding a Dimension .......................................................................................... 7 Processing a Dimension ............................................................................................................................ 82.2. Cube Objects ..................................................................................................................................... 8 Creating, Dropping, and Finding a Cube ................................................................................................... 8 Processing a Cube ..................................................................................................................................... 92.3. MeasureGroup Objects ................................................................................................................... 10 Creating, Dropping, and Finding a MeasureGroup ................................................................................. 10 Processing a Measure Group .................................................................................................................. 112.4. Partition Objects ............................................................................................................................. 12 Creating, Dropping, and Finding a Partition ........................................................................................... 12 Processing a Partition ............................................................................................................................. 12 Merging Partitions .................................................................................................................................. 122.5. Aggregation Objects........................................................................................................................ 132.6. Summary ......................................................................................................................................... 143. Customizing Analysis Services (AS) Cube using AMO in Project Server 2010 ..................................... 153.1. The code .......................................................................................................................................... 15 References .............................................................................................................................................. 15 Event Handler.......................................................................................................................................... 15 Retrieving AS DB Connection Strings ...................................................................................................... 15 Analysis Services Cube Customization .................................................................................................... 163.2. Deployment..................................................................................................................................... 17 Register Event Handler ........................................................................................................................... 17 Deploy Custom Assembly ....................................................................................................................... 19 The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 2 of 23
  • 3. Analysis Management Object Add Eventing Config Parameters ............................................................................................................ 203.3. Testing ............................................................................................................................................. 203.4. Debug .............................................................................................................................................. 224. References .......................................................................................................................................... 22 The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 3 of 23
  • 4. Analysis Management ObjectRevision history Name Date Reason for changes Version Huynh Thi 9/26/2011 Newly created 1.0 Bao Chau The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 4 of 23
  • 5. Analysis Management Object1. Analysis Management Object (AMO) 1.1. What is AMO? - Analysis Management Objects (AMO) is the complete library of programmatically accessed objects that enables an application to manage a running instance of Microsoft SQL Server Analysis Services. - AMO is an administrative object model you can use to programmatically manage instances of SSAS. AMO resides in the Microsoft.AnalysisServices namespace.There are a total of 260 classes found in this object model. - Like all other SSAS object models, AMO translates programmatic calls into XMLA (XML for Analysis Services) and sends the XMLA to the SSAS instance. 1.2. Architecture 1.3. AMO OLAP classesThe hierarchy of objects exposed through AMO The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 5 of 23
  • 6. Analysis Management Object The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 6 of 23
  • 7. Analysis Management Object2. Programming AMO OLAP Basic Objects 2.1. Dimension ObjectsCreating, Dropping, and Finding a DimensionCreating a Dimension object is accomplished in four steps: 1. Create the dimension object and populate basic attributes. 2. Create the attributes that define the dimension. 3. Create the hierarchies that the user will access to navigate the dimension. 4. Update the server by using the Update method of the current dimension.The following sample code creates the Product dimension for the AdventureWorks2008R2 SampleDatabases.static void CreateProductDimension(Database db, string datasourceName){// Create the Product dimensionDimension dim = db.Dimensions.FindByName("Product");if ( dim != null) {dim.Drop(); }dim = db.Dimensions.Add("Product");dim.Type = DimensionType.Products;dim.UnknownMember = UnknownMemberBehavior.Hidden;dim.AttributeAllMemberName = "All Products";dim.Source = new DataSourceViewBinding(datasourceName);dim.StorageMode = DimensionStorageMode.Molap;#region Create attributesDimensionAttributeattr;attr = dim.Attributes.Add("Product Name");attr.Usage = AttributeUsage.Key;attr.Type = AttributeType.Product;attr.OrderBy = OrderBy.Name;attr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "DimProduct","ProductKey"));attr.NameColumn = CreateDataItem(db.DataSourceViews[0], "DimProduct","EnglishProductName");#endregion#region Create hierarchies Hierarchy hier;hier = dim.Hierarchies.Add("Product Model Categories");hier.AllMemberName = "All Products";hier.Levels.Add("Category").SourceAttributeID = "Category";hier.Levels.Add("Subcategory").SourceAttributeID = "Subcategory"; The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 7 of 23
  • 8. Analysis Management Objecthier.Levels.Add("Model Name").SourceAttributeID = "Model Name";#endregiondim.Update();}staticDataItemCreateDataItem(DataSourceViewdsv, string tableName, stringcolumnName){DataTabledataTable = ((DataSourceView)dsv).Schema.Tables[tableName];DataColumndataColumn = dataTable.Columns[columnName];return new DataItem(tableName, columnName,OleDbTypeConverter.GetRestrictedOleDbType(dataColumn.DataType));}Processing a DimensionProcessing a dimension is as simple as using the Process method of the Dimension object.Processing a dimension can affect all cubes that use the dimension.The following code does an incremental update in all dimensions of a supplied database:static void UpdateAllDimensions(Database db){foreach (Dimension dim in db.Dimensions)dim.Process(ProcessType.ProcessUpdate);} 2.2. Cube ObjectsCreating, Dropping, and Finding a CubeManaging cubes is similar to managing dimensions. Creating a Cube object is accomplished in four steps: 1. Create the cube object and populate basic attributes. 2. Add the dimensions of the cube 3. Create the Measure Groups that the user will access to browse the data of the cube 4. Update the server by using the Update option ExpandFull to make sure that all objects are fully updated in the serverThe following code sample creates the parts of the Adventure Works cube.static void CreateAdventureWorksCube(Database db, string datasourceName) {// Create the Adventure Works cubeCube cube = db.Cubes.FindByName("Adventure Works");if ( cube != null) {cube.Drop(); The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 8 of 23
  • 9. Analysis Management Object }db.Cubes.Add("Adventure Works");cube.DefaultMeasure = "[Reseller Sales Amount]";cube.Source = new DataSourceViewBinding(datasourceName);cube.StorageMode = StorageMode.Molap;#region Create cube dimensions Dimension dim;dim = db.Dimensions.GetByName("Date");cube.Dimensions.Add(dim.ID, "Date", "Order Date Key - Dim Time");cube.Dimensions.Add(dim.ID, "Ship Date",Ship Date Key - Dim Time");cube.Dimensions.Add(dim.ID, "Delivery Date",”Delivery Date Key - Dim Time");dim = db.Dimensions.GetByName("Customer");cube.Dimensions.Add(dim.ID);dim = db.Dimensions.GetByName("Reseller");cube.Dimensions.Add(dim.ID);#endregion#region Create measure groupsCreateSalesReasonsMeasureGroup(cube);CreateInternetSalesMeasureGroup(cube);CreateResellerSalesMeasureGroup(cube);CreateCustomersMeasureGroup(cube);CreateCurrencyRatesMeasureGroup(cube); #endregioncube.Update(UpdateOptions.ExpandFull); }Processing a CubeProcessing a cube is as simple as using the Process method of the Cube object. Processing a cube alsoprocesses all measure groups in the cube, and all partitions in the measure group.In a cube, partitions are the only objects that can be processed; for the purposes of processing, measuregroups are only containers of partitions. The specified type of processing for the cube propagates to thepartitions. Processing of cube and measure group internally is resolved to processing of dimensions andpartitions.foreach (Cube cube in db.Cubes){cube.Process(ProcessType.ProcessFull);} The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 9 of 23
  • 10. Analysis Management Object 2.3. MeasureGroup ObjectsCreating, Dropping, and Finding a MeasureGroupManaging measure groups is similar to managing dimensions and cubes. Creating a MeasureGroupobject is accomplished in the following steps: 1. Create the measure group object and populate the basic attributes 2. Create the measure group, verify that the measure group does not exist. In the sample code that follows, if the measure group exists, then the measure group is dropped and re-created. 3. Add the dimensions of the measure group 4. Dimensions are added to the current measure group dimensions collection from the parent cube dimensions collection. As soon as the dimension is included in the measure group dimensions collection, a key column from the fact table can be mapped to the dimension so that the measure group can be browsed through the dimension. 5. Add the designed partitions of the measure group. 6. Update the server by using the Update method of current measure group.static void CreateInternetSalesMeasureGroup(Cube cube) { // Create the Internet Sales measure group Database db = cube.Parent;MeasureGroup mg = cube.MeasureGroups.FindByName("Internet Sales");if ( mg != null) {mg.Drop(); }mg = cube.MeasureGroups.Add("Internet Sales");mg.StorageMode = StorageMode.Molap;mg.ProcessingMode = ProcessingMode.LazyAggregations;mg.Type = MeasureGroupType.Sales;#region Create measures Measure meas;meas = mg.Measures.Add("Internet Sales Amount");meas.AggregateFunction = AggregationFunction.Sum;meas.FormatString = "Currency";meas.Source = CreateDataItem(db.DataSourceViews[0], "FactInternetSales","SalesAmount");meas = mg.Measures.Add("Internet Unit Price");meas.AggregateFunction = AggregationFunction.Sum;meas.FormatString = "Currency";meas.Visible = false;meas.Source = CreateDataItem(db.DataSourceViews[0], "FactInternetSales","UnitPrice"); #endregion The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 10 of 23
  • 11. Analysis Management Object#region Create measure group dimensionsCubeDimensioncubeDim;RegularMeasureGroupDimensionregMgDim;ManyToManyMeasureGroupDimensionmmMgDim;MeasureGroupAttributemgAttr; // Mapping dimension and key column from fact table // > select dimension and add it to the measure groupcubeDim = cube.Dimensions.GetByName("Date");regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);mg.Dimensions.Add(regMgDim); // > add key column from dimension and map it with // the surrogate key in the fact tablemgAttr =regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Date").ID);// this is dimension key columnmgAttr.Type = MeasureGroupAttributeType.Granularity;mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0],"FactInternetSales", "OrderDateKey")); // this surrogate key in fact tablecubeDim = cube.Dimensions.GetByName("Product");regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);mg.Dimensions.Add(regMgDim);mgAttr =regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("ProductName").ID);mgAttr.Type = MeasureGroupAttributeType.Granularity;mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0],"FactInternetSales", "ProductKey")); #endregion#region Create partitionsCreateInternetSalesMeasureGroupPartitions( mg) #endregion }Processing a Measure GroupProcessing a measure group is as simple as using the Process method of the MeasureGroup object.Processing a measure group will process all partitions that belong to the measure group. Processing ameasure group internally is resolved to processing dimensions and partitions.static void FullProcessAllMeasureGroups(Cube cube) {foreach (MeasureGroup mg in cube.MeasureGroups)mg.Process(ProcessType.ProcessFull); } The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 11 of 23
  • 12. Analysis Management Object 2.4. Partition ObjectsCreating, Dropping, and Finding a PartitionPartitions are simple objects that can be created in two steps. 1. Create the partition object and populate the basic attributes. 2. Update the server by using the Update method of the current partition.The following code sample creates partitions for the InternetSales measure group.static void CreateInternetSalesMeasureGroupPartitions(MeasureGroup mg) { Partition part;part = mg.Partitions.FindByName("Internet_Sales_184");if ( part != null) {part.Drop(); }part = mg.Partitions.Add("Internet_Sales_184");part.StorageMode = StorageMode.Molap;part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM[dbo].[FactInternetSales] WHERE OrderDateKey<= 184");part.Slice = "[Date].[Calendar Year].&[2001]";part.Annotations.Add("LastOrderDateKey", "184");part = mg.Partitions.FindByName("Internet_Sales_549");if ( part != null) {part.Drop(); }part = mg.Partitions.Add("Internet_Sales_549");part.StorageMode = StorageMode.Molap;part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM[dbo].[FactInternetSales] WHERE OrderDateKey> 184 AND OrderDateKey<=549");part.Slice = "[Date].[Calendar Year].&[2002]";part.Annotations.Add("LastOrderDateKey", "549"); }Processing a PartitionProcessing a partition is as simple as using the Process method of the Partition object.static void FullProcessAllPartitions(MeasureGroup mg) {foreach (Partition part in mg.Partitions)part.Process(ProcessType.ProcessFull); }Merging Partitions The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 12 of 23
  • 13. Analysis Management ObjectMerging partitions means performing any operation that results in two or more partitions becoming onepartition.Partitions can be merged only if they meet all the following criteria: - Partitions are in the same measure group. - Partitions are stored in the same mode (MOLAP, HOLAP, and ROLAP). - Partitions reside on the same server; remote partitions can be merged if on the same server.static void MergeAllPartitions(MeasureGroup mg){if (mg.Partitions.Count> 1) {Partition[] partArray = new Partition[mg.Partitions.Count - 1];for (int i = 1; i <mg.Partitions.Count; i++)partArray[i - 1] = mg.Partitions[i];mg.Partitions[0].Merge(partArray); //To have last changes in the server reflected in AMOmg.Refresh(); } 2.5. Aggregation ObjectsAggregations can easily be created and assigned to measure groups or to partitions by using theDesignAggregations method from the AggregationDesign object.static public String DesignAggregationsOnPartitions(MeasureGroup mg, doubleoptimizationWanted, double maxStorageBytes) {double optimization = 0;double storage = 0;longaggCount = 0;bool finished = false;AggregationDesign ad = null; String aggDesignName; String AggregationsDesigned = "";aggDesignName = mg.AggregationPrefix + "_" + mg.Name;ad = mg.AggregationDesigns.Add();ad.Name = aggDesignName;ad.InitializeDesign();while ((!finished) && (optimization <optimizationWanted) && (storage<maxStorageBytes)) {ad.DesignAggregations(out optimization, out storage, out aggCount, outfinished); }ad.FinalizeDesign();foreach (Partition part in mg.Partitions) { The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 13 of 23
  • 14. Analysis Management Objectpart.AggregationDesignID = ad.ID;AggregationsDesigned += aggDesignName + " = " + aggCount.ToString() + "aggregations designedrntOptimization: " + optimization.ToString() + "/" +optimizationWanted.ToString() + "nrtStorage: " + storage.ToString() + "/"+ maxStorageBytes.ToString() + " ]nr"; }returnAggregationsDesigned; } 2.6. Summary Managing Objects AMO (C#)Connecting to the Server amoServer.Connect("SS2005_Server");Creating database amoDB = amoServer.Databases.Add("NewDb"); amoDB.Update();Create cube amoCube = amoDB.Cubes.Add("NewCube"); amoCube.Update();Create measure //in SQL Server, Analysis Services cubes can have more than 1 measure group. A measure group was required before adding the measure amoMG = amoCube.MeasureGroups.Add("NewMeasureGroup"); amoMeas = amoMG.Measures.Add("NewMeasure"); amoMG.Update();Removing database //being amoDB a database object //the database pointed by amoDB is dropped from system amoDB.Drop();Removing cube //being amoCube a cube object //the cube pointed by amoCube is dropped from system amoCube.Drop();Changing Object //Start cube definition //Set Description for new cube amoCube.Description = "simplified sales cube"; //Provide the data source for the cube. amoCube.Source = new DataSourceViewBinding("FoodMart"); //Update cube to save changes amoCube.Update(); The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 14 of 23
  • 15. Analysis Management ObjectProcessing Objects //Default processing for all objects in a database dsoDB.Process( ProcessType.ProcessDefault); //Full processing a cube amoCube.Process( ProcessType.ProcessFull);3. Customizing Analysis Services (AS) Cube using AMO in Project Server 2010 3.1. The codeReferencesTo be able to override an EPM 2010 Event Handler and do AMO customization you will have to add thefollowing references to the C# Class Library solution: - C:Program FilesMicrosoft SQL Server90SDKAssembliesMicrosoft.AnalysisServices.dll - C:Program FilesMicrosoft Office Servers12.0BinMicrosoft.Office.Project.Server.Events.Receivers.dll - C:Program FilesMicrosoft Office Servers14.0BinMicrosoft.Office.Project.Server.Library.dllEvent HandlerThe CubeProcecessedEvent is overridden to launch our Analysis Services Cube customization once thestandard EPM 2010 cube has been built:// Override CBS event to call custom AMO codepublicclassCubeProcessedEvent : CubeAdminEventReceiver { #region Public Methodspublicoverridevoid OnCubeProcessed(PSContextInfo contextInfo,CubeAdminPostCubeProcessEventArgs e) {base.OnCubeProcessed(contextInfo, e);// Process Analysis Services customization ProcessCubeCustomisation(e.DbName); }Retrieving AS DB Connection StringsThe CONFIG file is located under: C:Program FilesMicrosoft Office Servers14.0Bin// --------------------------------------------// STEP 0: Retrieve Analysis Services server configuration from// Microsoft.Office.Project.Server.Eventing.exe.config// -------------------------------------------- The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 15 of 23
  • 16. Analysis Management Objectstring connectionString =ConfigurationManager.AppSettings["ASConnectionString"];Analysis Services Cube CustomizationThis is the main method doing all the Analysis Services customization (using AMO):privatevoid ProcessCubeCustomisation(string databaseName) {Stopwatch timeToProcess = newStopwatch();timeToProcess.Start();bool success = false;string msg = string.Empty;try{// --------------------------------------------// STEP 0: Retrieve Analysis Services server configuration from// Microsoft.Office.Project.Server.Eventing.exe.config// --------------------------------------------string connectionString =ConfigurationManager.AppSettings["ASConnectionString"];string databaseName = ConfigurationManager.AppSettings["ASDatabaseName"];// --------------------------------------------// STEP 1: Connect to Analysis Services server.// --------------------------------------------Server asServer = newServer(); asServer.Connect(connectionString);// --------------------------------------------// STEP 2: Locate the necessary OLAP objects.// --------------------------------------------Database p12Database = asServer.Databases.GetByName(databaseName); // thisthrows exception if the database is not foundCube mspPortfolioAnalyzer =p12Database.Cubes.GetByName("MSP_Portfolio_Analyzer");Dimension taskListDimension = p12Database.Dimensions.GetByName("Task List");// this throws exception if the dimension is not found// --------------------------------------------// STEP 3: Perform OLAP customisation// --------------------------------------------DimensionAttribute tnDimAtt = taskListDimension.Attributes.Add("Task Name"); tnDimAtt.Usage = AttributeUsage.Regular; tnDimAtt.Type = AttributeType.Regular; tnDimAtt.OrderBy = OrderBy.Name; tnDimAtt.KeyColumns.Add(CreateDataItem(p12Database.DataSourceViews[0],"MSP_EpmTask_OlapView_Dimension", "TaskName")); tnDimAtt.NameColumn = CreateDataItem(p12Database.DataSourceViews[0],"MSP_EpmTask_OlapView_Dimension", "TaskName");// Create Task Name HierarchyHierarchy tnHierarchy =taskListDimension.Hierarchies.Add("TaskNameHierarchy"); The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 16 of 23
  • 17. Analysis Management ObjectDimensionAttribute tlAttribute = taskListDimension.Attributes.GetByName("TaskList attribute"); tlAttribute.AttributeRelationships.Add("Task Name"); tnHierarchy.Levels.Add(tnDimAtt.Name).SourceAttributeID = tnDimAtt.Name; tnHierarchy.Levels.Add(tlAttribute.Name).SourceAttributeID =tlAttribute.Name;ValidationErrorCollection errorCol = newValidationErrorCollection(); taskListDimension.Validate(errorCol, true);// --------------------------------------------// STEP 4: Process updates// --------------------------------------------// Process dimension update p12Database.Update(UpdateOptions.ExpandFull); p12Database.Process(ProcessType.ProcessFull); success = true;}catch (Exception e){ msg = "FAILED to process AS customisation, exception: " + e.Message;}timeToProcess.Stop();if (success) WriteEvent("SUCCESSFULY processed AS customisation, Time= " +timeToProcess.Elapsed.ToString(), EventLogEntryType.Information, 9999);else WriteEvent(msg + " , Time= " + timeToProcess.Elapsed.ToString(),EventLogEntryType.Error, 9999); }privateDataItemCreateDataItem(DataSourceViewdsv, stringtableName, stringcolumnName) {stringselectedTableName = tableName;for (int i = 0; i < ((DataSourceView)dsv).Schema.Tables.Count; i++ ) {if (((DataSourceView)dsv).Schema.Tables[i].TableName.Contains(tableName)) {selectedTableName = ((DataSourceView)dsv).Schema.Tables[i].TableName;break; } }DataTabledataTable = ((DataSourceView)dsv).Schema.Tables[selectedTableName];DataColumndataColumn = dataTable.Columns[columnName];returnnewDataItem(selectedTableName, columnName,OleDbTypeConverter.GetRestrictedOleDbType(dataColumn.DataType)); } 3.2. DeploymentThe procedure to deploy custom Event Handler (calling custom AMO code) is as follow:Register Event Handler The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 17 of 23
  • 18. Analysis Management Object 1. Connect to the PWA server and go to Server Settings 2. Select Operational Policies ->Server-Side Event Handler Configuration 3. Select Cube Admin ->Cube Processed 4. Enter the following information and click Save: Name CustomTask Name Hierarchy Description Custom AMO code thataggregatestasks by name Assembly Name CoastalPoint.CustomProjectServer.AMOEvent, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=9af84715c1210e08 Classe Name CoastalPoint.CustomProjectServer.AMOEvent.CubeProcessedEvent Order 1 The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 18 of 23
  • 19. Analysis Management Object Once the assembly has been deployed it should appear as shown below (takes a few minutes to take effect):Deploy Custom Assembly 1. Copy compiled assembly AMOEvent.dll from proper BIN directory to C:WINDOWSassembly (Drag & Drop) 2. Assembly should now appear in the folder as shown below: The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 19 of 23
  • 20. Analysis Management ObjectAdd EventingConfig Parameters 1. Copy the EPM Eventingconfig file located under C:Program FilesMicrosoft Office Servers12.0BinMicrosoft.Office.Project.Server.Eventing.exe.config to have a backup and open the file using an XML editor 2. Add the following parameter: ASConnectionString <configuration> <runtime> <assemblyBindingxmlns="urn:schemas-microsoft-com:asm.v1"> <probingprivatePath="ProjectServerEventHandlers"/> </assemblyBinding> </runtime> <appSettings> <addkey="ASConnectionString"value="CHRISFIE03SQL" /> </appSettings> </configuration> 3.3. TestingFirst you will have to the build the cube with the newly deployed customization.The CBS (Cube Building Process) will look like this: The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 20 of 23
  • 21. Analysis Management ObjectEnsure that the newly added hierarchy has been added to the cube using Visual Studio: The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 21 of 23
  • 22. Analysis Management ObjectSpecifically: 3.4. Debug - Deploy project - Go to Service, restart 2 services: Microsoft Project Server Events Service 2010 and Microsoft Project Server Queue Service 2010 - Attach process : Microsoft.Office.Project.Server.Eventing.exe - Go to PWA -> Server Settings -> OLAP Database Management, choose a database and click Build Now button.4. References The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 22 of 23
  • 23. Analysis Management Objecthttp://msdn.microsoft.com/en-us/library/ms124924.aspxhttp://ssas-wiki.com/w/Articles#Analysis_Management_Objects_.28AMO.29http://blogs.msdn.com/b/chrisfie/archive/2007/08/06/customizing-analysis-services-cube-using-analysis-management-objects-amo.aspx The information contained herein is confidential and proprietary and should not be disclosed, copied or duplicated in any manner without written permission of Coastal Point Solutions.Customize Project Server 2010 Document Version1.0 Page 23 of 23