A time series database workbook enables the user to load and save its settings and settings for factors tree.
The following settings are saved and loaded:
Attributes and their order.
Filtering parameters for each attribute.
The sort order for each attribute
Names of levels for attribute dimensions.
Determined alternate hierarchy.
Parameters of the Calculation Results panel.
The settings are saved only for the time series databases which series are used in the workbook.
Executing the example requires a .NET form with the following components:
The Save button with the SaveButton identifier.
The Load button with the LoadButton identifier.
The LanerBoxNet component.
The LanerResultBox component.
The UiErAnalyzerNet component with the UiErAnalyzerNet1 identifier. This component contains the workbook of time series database that is the data source of the LanerBox and LanerResultBox components.
The MetaAttributesBreadcrumbNet component with the MetaAttributesBreadcrumbNet1 identifier. This component must use the same time series database as workbook that is loaded to UiErAnalyzerNet1.
The MetaAttributesTreeListNet component connected with the MetaAttributesBreadcrumbNet1.
Add links to the namespaces:
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Cubes;
The workbook settings are saved by clicking the Save button and loaded by clicking the Load button.
This procedure is a handler of the Click event for the SaveButton button.
Private Sub SaveButton_Click(sender: System.Object; e: System.EventArgs);
Var
Doc: FreeThreadedDOMDocument60;
Element: IXmlDomElement;
Ea: IEaxAnalyzer;
Wb: IEaxWorkbook;
WbTree: IEaxWorkbookMetaAttributesTree;
Rub: IRubricator;
OpList: IEaxWorkbookRubricatorOptionsList;
Options: IEaxWorkbookRubricatorOptions;
Statistics: IEaxWorkbookStatistics;
Begin
// Save the MetaAttributesBreadcrumbNet1 settings to XML
Doc := New FreeThreadedDOMDocument60.Create();
Element := Doc.createElement("Breadcrumb");
MetaAttributesBreadcrumbNet1.CtrlBox.SaveState(Element);
Doc.appendChild(Element);
// Get workbook
Ea := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
Wb := Ea As IEaxWorkbook;
// Get object tree settings
WbTree := Wb.MetaAttributesTree;
Rub := MetaAttributesBreadcrumbNet1.Rubricator.Rubricator;
// Get directory settings, connected to the object tree
OpList := WbTree.RubricatorsOptions;
// Clear settings
OpList.Clear();
If Options = Null Then
Options := OpList.Add(Rub As IMetabaseObjectDescriptor);
System.Diagnostics.Debug.WriteLine(Time series database: " + Options.RubricatorObject.Name);
End If;
// Set the settings for dimensions tree
Options.HierarchyAttributes := Doc.xml;
// Set settings for the Calculation results panel
Statistics := Wb.Statistics;
Statistics.Enabled := True;
Statistics.Visible := False;
// Save workbook
(Ea As IMetabaseObject).Save();
End Sub;
All settings, specified for the workbook that is loaded to LanerBox, are saved after executing the example.
This procedure is a handler of the Click event for the LoadButton button.
Private Sub LoadButton_Click(sender: System.Object; e: System.EventArgs);
Var
Rub: IRubricator;
RubKey: integer;
Doc: FreeThreadedDOMDocument60;
Element: IXmlDomElement;
Ea: IEaxAnalyzer;
Wb: IEaxWorkbook;
WbTree: IEaxWorkbookMetaAttributesTree;
OpList: IEaxWorkbookRubricatorOptionsList;
Options: IEaxWorkbookRubricatorOptions;
Begin
// Get time series database,
// linked with MetaAttributesBreadcrumbNet1
Rub := MetaAttributesBreadcrumbNet1.Rubricator.Rubricator;
RubKey := (Rub As IMetabaseObjectDescriptor).Key As integer;
// Get workbook
Ea := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
Wb := Ea As IEaxWorkbook;
// Get object tree settings
WbTree := Wb.MetaAttributesTree;
// Get directory settings, connected to the object tree
OpList := WbTree.RubricatorsOptions;
Options := OpList.Item[RubKey];
// Load saved settings from the workbook MetaAttributesBreadcrumb1
If Options <> Null Then
Doc := New FreeThreadedDOMDocument60.Create();
If (Doc.loadXML(Options.HierarchyAttributes)) Then
Element := Doc.selectSingleNode("Breadcrumb") As IXmlDomElement;
If (Element <> Null) Then
MetaAttributesBreadcrumbNet1.CtrlBox.LoadState(Element);
End If;
Else
System.Diagnostics.Debug.WriteLine(Error loading an XML);
End If;
End If;
// Load saved setting from the workbook of the Calculation Results panel
lanerResultBoxNet1.ResultContainerVisible := Wb.Statistics.Visible;
End Sub;
All saved settings are loaded for the workbook that is loaded to LanerBox, after executing the example.
See also: