OpenObjectContext: IEaxOpenObjectContext;
The OpenObjectContext property returns the settings sent to the opened object.
It is relevant if the opened object is a regular report.
To use the sent settings, a parameter with the REPORT_OPEN_CONTEXT identifier should be created in the report. The settings in the XML format determined in the OpenObjectContext property will be sent to this parameter. If custom settings are to be sent, they can be handled in an application macro of the opened report.
Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier and a regular report with the REPORT identifier.
Add links to the Dimensions, Express, Metabase, Pivot, Report, Tab, Xml system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Eax: IEaxAnalyzer;
PivSlice: IEaxDataAreaPivotSlice;
Pivot: IPivot;
HeadSets: IDataAreaHeaderSettingsBase;
Grid: IEaxGrid;
DimSettings: IEaxGridDimensionSettings;
PivotDims: IPivotDimension;
DimModel: IDimensionModel;
DimIndex: IDimIndex;
Attributes: IDimAttributesInstance;
Attribute: IDimAttribute;
Drill: IEaxDrillSettings;
OpenContext: IEaxOpenObjectContext;
XMLDoc: IXMLDOMDocument;
XMLElem: IXMLDOMElement;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get regular report
Eax := MB.ItemById("EXPRESS_REPORT").Edit As IEaxAnalyzer;
// Get data slice as a report table data area
PivSlice := Eax.DataArea.Slices.Item(0) As IEaxDataAreaPivotSlice;
// Get data table
Pivot := PivSlice.Pivot;
// Get dimension
PivotDims := Pivot.Dimensions.Item(1);
// Get dimension structure
DimModel := PivotDims.DimInstance.Dimension;
// Get structure of the specified dimension index
DimIndex := DimModel.Indexes.Item(0);
// Get collection of dimension attributes
Attributes := PivotDims.DimInstance.Attributes;
// Get structure of the specified attribute
Attribute := Attributes.Item(0).Attribute;
// Get settings of analytical data area title
HeadSets := PivotDims As IDataAreaHeaderSettingsBase;
// Enable drill down settings for the specified view
Grid := (PivSlice As IEaxDataAreaSlice).Views.Item(0) As IEaxGrid;
Grid.ViewSettings.HyperlinkAsText := False;
DimSettings := Grid.ViewSettings.GetViewSettings(HeadSets) As IEaxGridDimensionSettings;
If Not DimSettings.IsDrilled Then
DimSettings.Drilled := TriState.OnOption;
End If;
// Get drill down settings
Drill := DimSettings.Drill;
// Specify sheet
Drill.SheetKey := Eax.Sheets.Item(0).Key;
// Specify dimension
Drill.Dimension := PivotDims;
// Set method for changing selection - replace
Drill.Mode := EaxDataDrillMode.Replace;
// Set index for element search
Drill.DimensionIndex := DimIndex;
// Set search attribute in index
Drill.DimensionAttribute := Attribute;
// Regular report will be opened on hyperlink click
Drill.ActionType := TabHyperlinkActionType.OpenObject;
Drill.Action := "REPORT";
OpenContext := Drill.OpenObjectContext;
OpenContext.ActiveSheetKey := 2;
OpenContext.EnableUserData := True;
XMLDoc := New FreeThreadedDOMDocument60.Create;
XMLElem := XMLDoc.createElement("Root");
XMLDoc.appendChild(XMLElem);
OpenContext.ExternalXML := XMLDoc.documentElement;
// Save settings
OpenContext.SaveToXml(XMLElem);
XMLDoc.save("D:\OpenObjectContext.xml");
Eax.RefreshAll;
(Eax As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, drill down is set up for express report dimension. A regular report opens on the second sheet on clicking on elements. The custom data that can be handled in an application macro will also be sent to the report. The settings sent to the p[ened object will be saved to an XML file.
See also: