public Perspective Clone() { var p = new Perspective(Name); p.MeasureGroups = MeasureGroups.Clone(); p.Dimensions = Dimensions.Clone(); return(p); }
internal void FromPivotCacheDefinition(PivotCacheDefinition pcd) { SetAllNull(); if (pcd.Id != null) { Id = pcd.Id.Value; } if (pcd.Invalid != null) { Invalid = pcd.Invalid.Value; } if (pcd.SaveData != null) { SaveData = pcd.SaveData.Value; } if (pcd.RefreshOnLoad != null) { RefreshOnLoad = pcd.RefreshOnLoad.Value; } if (pcd.OptimizeMemory != null) { OptimizeMemory = pcd.OptimizeMemory.Value; } if (pcd.EnableRefresh != null) { EnableRefresh = pcd.EnableRefresh.Value; } if (pcd.RefreshedBy != null) { RefreshedBy = pcd.RefreshedBy.Value; } if (pcd.RefreshedDate != null) { RefreshedDate = pcd.RefreshedDate.Value; } if (pcd.BackgroundQuery != null) { BackgroundQuery = pcd.BackgroundQuery.Value; } if (pcd.MissingItemsLimit != null) { MissingItemsLimit = pcd.MissingItemsLimit.Value; } if (pcd.CreatedVersion != null) { CreatedVersion = pcd.CreatedVersion.Value; } if (pcd.RefreshedVersion != null) { RefreshedVersion = pcd.RefreshedVersion.Value; } if (pcd.MinRefreshableVersion != null) { MinRefreshableVersion = pcd.MinRefreshableVersion.Value; } if (pcd.RecordCount != null) { RecordCount = pcd.RecordCount.Value; } if (pcd.UpgradeOnRefresh != null) { UpgradeOnRefresh = pcd.UpgradeOnRefresh.Value; } if (pcd.IsTupleCache != null) { IsTupleCache = pcd.IsTupleCache.Value; } if (pcd.SupportSubquery != null) { SupportSubquery = pcd.SupportSubquery.Value; } if (pcd.SupportAdvancedDrill != null) { SupportAdvancedDrill = pcd.SupportAdvancedDrill.Value; } if (pcd.CacheSource != null) { CacheSource.FromCacheSource(pcd.CacheSource); } // doing one by one because it's bloody hindering awkward complicated. if (pcd.CacheFields != null) { SLCacheField cf; using (var oxr = OpenXmlReader.Create(pcd.CacheFields)) { while (oxr.Read()) { if (oxr.ElementType == typeof(CacheField)) { cf = new SLCacheField(); cf.FromCacheField((CacheField)oxr.LoadCurrentElement()); CacheFields.Add(cf); } } } } if (pcd.CacheHierarchies != null) { SLCacheHierarchy ch; using (var oxr = OpenXmlReader.Create(pcd.CacheHierarchies)) { while (oxr.Read()) { if (oxr.ElementType == typeof(CacheHierarchy)) { ch = new SLCacheHierarchy(); ch.FromCacheHierarchy((CacheHierarchy)oxr.LoadCurrentElement()); CacheHierarchies.Add(ch); } } } } if (pcd.Kpis != null) { SLKpi k; using (var oxr = OpenXmlReader.Create(pcd.Kpis)) { while (oxr.Read()) { if (oxr.ElementType == typeof(Kpi)) { k = new SLKpi(); k.FromKpi((Kpi)oxr.LoadCurrentElement()); Kpis.Add(k); } } } } if (pcd.TupleCache != null) { TupleCache.FromTupleCache(pcd.TupleCache); HasTupleCache = true; } if (pcd.CalculatedItems != null) { SLCalculatedItem ci; using (var oxr = OpenXmlReader.Create(pcd.CalculatedItems)) { while (oxr.Read()) { if (oxr.ElementType == typeof(CalculatedItem)) { ci = new SLCalculatedItem(); ci.FromCalculatedItem((CalculatedItem)oxr.LoadCurrentElement()); CalculatedItems.Add(ci); } } } } if (pcd.CalculatedMembers != null) { SLCalculatedMember cm; using (var oxr = OpenXmlReader.Create(pcd.CalculatedMembers)) { while (oxr.Read()) { if (oxr.ElementType == typeof(CalculatedMember)) { cm = new SLCalculatedMember(); cm.FromCalculatedMember((CalculatedMember)oxr.LoadCurrentElement()); CalculatedMembers.Add(cm); } } } } if (pcd.Dimensions != null) { SLDimension d; using (var oxr = OpenXmlReader.Create(pcd.Dimensions)) { while (oxr.Read()) { if (oxr.ElementType == typeof(Dimension)) { d = new SLDimension(); d.FromDimension((Dimension)oxr.LoadCurrentElement()); Dimensions.Add(d); } } } } if (pcd.MeasureGroups != null) { SLMeasureGroup mg; using (var oxr = OpenXmlReader.Create(pcd.MeasureGroups)) { while (oxr.Read()) { if (oxr.ElementType == typeof(MeasureGroup)) { mg = new SLMeasureGroup(); mg.FromMeasureGroup((MeasureGroup)oxr.LoadCurrentElement()); MeasureGroups.Add(mg); } } } } if (pcd.Maps != null) { SLMeasureDimensionMap mdm; using (var oxr = OpenXmlReader.Create(pcd.Maps)) { while (oxr.Read()) { if (oxr.ElementType == typeof(MeasureDimensionMap)) { mdm = new SLMeasureDimensionMap(); mdm.FromMeasureDimensionMap((MeasureDimensionMap)oxr.LoadCurrentElement()); Maps.Add(mdm); } } } } }
// Generates content of pivotTableCacheDefinitionPart1. private void GeneratePivotTableCacheDefinitionPart1Content(PivotTableCacheDefinitionPart pivotTableCacheDefinitionPart1) { PivotCacheDefinition pivotCacheDefinition1 = new PivotCacheDefinition(){ SaveData = false, RefreshedBy = "Paul Berruti", RefreshedDate = 40855.575896064816D, BackgroundQuery = true, CreatedVersion = 5, RefreshedVersion = 5, MinRefreshableVersion = 3, RecordCount = (UInt32Value)0U, SupportSubquery = true, SupportAdvancedDrill = true }; pivotCacheDefinition1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CacheSource cacheSource1 = new CacheSource(){ Type = SourceValues.External, ConnectionId = (UInt32Value)3U }; CacheFields cacheFields1 = new CacheFields(){ Count = (UInt32Value)0U }; CacheHierarchies cacheHierarchies1 = new CacheHierarchies(){ Count = (UInt32Value)11U }; CacheHierarchy cacheHierarchy1 = new CacheHierarchy(){ UniqueName = "[Query].[account_id]", Caption = "account_id", Attribute = true, DefaultMemberUniqueName = "[Query].[account_id].[All]", AllUniqueName = "[Query].[account_id].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy2 = new CacheHierarchy(){ UniqueName = "[Query].[account_parent]", Caption = "account_parent", Attribute = true, DefaultMemberUniqueName = "[Query].[account_parent].[All]", AllUniqueName = "[Query].[account_parent].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy3 = new CacheHierarchy(){ UniqueName = "[Query].[account_description]", Caption = "account_description", Attribute = true, DefaultMemberUniqueName = "[Query].[account_description].[All]", AllUniqueName = "[Query].[account_description].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy4 = new CacheHierarchy(){ UniqueName = "[Query].[account_type]", Caption = "account_type", Attribute = true, DefaultMemberUniqueName = "[Query].[account_type].[All]", AllUniqueName = "[Query].[account_type].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy5 = new CacheHierarchy(){ UniqueName = "[Query].[account_rollup]", Caption = "account_rollup", Attribute = true, DefaultMemberUniqueName = "[Query].[account_rollup].[All]", AllUniqueName = "[Query].[account_rollup].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy6 = new CacheHierarchy(){ UniqueName = "[Query].[Custom Members]", Caption = "Custom Members", Attribute = true, DefaultMemberUniqueName = "[Query].[Custom Members].[All]", AllUniqueName = "[Query].[Custom Members].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy7 = new CacheHierarchy(){ UniqueName = "[Query].[CurrentUser]", Caption = "CurrentUser", Attribute = true, DefaultMemberUniqueName = "[Query].[CurrentUser].[All]", AllUniqueName = "[Query].[CurrentUser].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy8 = new CacheHierarchy(){ UniqueName = "[Query].[RefreshTime]", Caption = "RefreshTime", Attribute = true, DefaultMemberUniqueName = "[Query].[RefreshTime].[All]", AllUniqueName = "[Query].[RefreshTime].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false }; CacheHierarchy cacheHierarchy9 = new CacheHierarchy(){ UniqueName = "[Query].[RowNumber]", Caption = "RowNumber", Attribute = true, KeyAttribute = true, DefaultMemberUniqueName = "[Query].[RowNumber].[All]", AllUniqueName = "[Query].[RowNumber].[All]", DimensionUniqueName = "[Query]", DisplayFolder = "", Count = (UInt32Value)0U, Unbalanced = false, Hidden = true }; CacheHierarchy cacheHierarchy10 = new CacheHierarchy(){ UniqueName = "[Measures].[__XL_Count Query]", Caption = "__XL_Count Query", Measure = true, DisplayFolder = "", MeasureGroup = "Query", Count = (UInt32Value)0U, Hidden = true }; CacheHierarchy cacheHierarchy11 = new CacheHierarchy(){ UniqueName = "[Measures].[__XL_Count of Models]", Caption = "__XL_Count of Models", Measure = true, DisplayFolder = "", Count = (UInt32Value)0U, Hidden = true }; cacheHierarchies1.Append(cacheHierarchy1); cacheHierarchies1.Append(cacheHierarchy2); cacheHierarchies1.Append(cacheHierarchy3); cacheHierarchies1.Append(cacheHierarchy4); cacheHierarchies1.Append(cacheHierarchy5); cacheHierarchies1.Append(cacheHierarchy6); cacheHierarchies1.Append(cacheHierarchy7); cacheHierarchies1.Append(cacheHierarchy8); cacheHierarchies1.Append(cacheHierarchy9); cacheHierarchies1.Append(cacheHierarchy10); cacheHierarchies1.Append(cacheHierarchy11); Kpis kpis1 = new Kpis(){ Count = (UInt32Value)0U }; Dimensions dimensions1 = new Dimensions(){ Count = (UInt32Value)2U }; Dimension dimension1 = new Dimension(){ Measure = true, Name = "Measures", UniqueName = "[Measures]", Caption = "Measures" }; Dimension dimension2 = new Dimension(){ Name = "Query", UniqueName = "[Query]", Caption = "Query" }; dimensions1.Append(dimension1); dimensions1.Append(dimension2); MeasureGroups measureGroups1 = new MeasureGroups(){ Count = (UInt32Value)1U }; MeasureGroup measureGroup1 = new MeasureGroup(){ Name = "Query", Caption = "Query" }; measureGroups1.Append(measureGroup1); Maps maps1 = new Maps(){ Count = (UInt32Value)1U }; MeasureDimensionMap measureDimensionMap1 = new MeasureDimensionMap(){ MeasureGroup = (UInt32Value)0U, Dimension = (UInt32Value)1U }; maps1.Append(measureDimensionMap1); PivotCacheDefinitionExtensionList pivotCacheDefinitionExtensionList1 = new PivotCacheDefinitionExtensionList(); PivotCacheDefinitionExtension pivotCacheDefinitionExtension1 = new PivotCacheDefinitionExtension(){ Uri = "{725AE2AE-9491-48be-B2B4-4EB974FC3084}" }; pivotCacheDefinitionExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.PivotCacheDefinition pivotCacheDefinition2 = new X14.PivotCacheDefinition(){ SupportSubqueryNonVisual = true, SupportSubqueryCalcMem = true, SupportAddCalcMems = true }; pivotCacheDefinitionExtension1.Append(pivotCacheDefinition2); pivotCacheDefinitionExtensionList1.Append(pivotCacheDefinitionExtension1); pivotCacheDefinition1.Append(cacheSource1); pivotCacheDefinition1.Append(cacheFields1); pivotCacheDefinition1.Append(cacheHierarchies1); pivotCacheDefinition1.Append(kpis1); pivotCacheDefinition1.Append(dimensions1); pivotCacheDefinition1.Append(measureGroups1); pivotCacheDefinition1.Append(maps1); pivotCacheDefinition1.Append(pivotCacheDefinitionExtensionList1); pivotTableCacheDefinitionPart1.PivotCacheDefinition = pivotCacheDefinition1; }