GetData(objectId: String, valIndx: Integer): Variant;
GetData(objectId: string, valIndx: integer): object;
objectId. Dimension identifier.
valIndx. Element index.
The GetData method returns data of set dimension element by its index.
Data is returned if there is default attribute value. To get default attribute, use the IVZMultiplyDataSource.DefaultAttributeId method.
Executing the example requires that the repository contains an express report with the EXPRESS identifier.
Add links to the Express, Metabase, Visualizators system assemblies.
Sub UserProc;
Var
Metabase: IMetabase;
EaxAnalyzer: IEaxAnalyzer;
BubbleTree: IVZBubbleTree;
DataSource: IVZMultiplyDataSource;
StringArrayAttr: IVZStringArray;
StringArrayObj: IVZStringArray;
DataArray: IVZDataArray;
DataDictionary: IVZDataDictionary;
AttrId: String;
ValIndx: Integer;
ObjectId: String;
Data: Variant;
Begin
// Get repository object
Metabase := MetabaseClass.Active;
// Open express report
EaxAnalyzer := Metabase.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get bubble tree
BubbleTree := EaxAnalyzer.BubbleTree.BubbleTree;
// Get visualizer data source
DataSource := BubbleTree.ColorVisual.ColorMapping.DataSource;
// Set data source name
DataSource.Title := "Visualizator data source";
// Create and fill array of attributes and data source objects
StringArrayAttr := New VZStringArray.Create;
StringArrayAttr := DataSource.GetAttributes;
StringArrayObj := New VZStringArray.Create;
StringArrayObj := DataSource.GetObjects;
// Get dictionary of bubble tree element names
DataSource.ItemsNames := BubbleTree.Captions;
// Display information about data source
Debug.WriteLine("Data source index: " + DataSource.ID);
Debug.WriteLine("Data source title: " + DataSource.Title);
Debug.WriteLine("Maximum capacity of dimensions (time line): " +
DataSource.MaxTimelineIndex.ToString);
// Get attribute identifier
AttrId := BubbleTree.ColorVisual.ColorMapping.AttributeId;
// Set index with respect to time scale
ValIndx := 0;
// Set object index
ObjectId := "99";
// Get default attribute identifier
Debug.WriteLine("Default attribute identifier: " + DataSource.DefaultAttributeId);
// Determine attribute name by using dictionary of factor names
Debug.WriteLine("Indicator name: " + DataSource.AttributesNames.Item(AttrId));
// Get maximum and minimum indicator values
Debug.WriteLine("Maximum value: " + DataSource.GetMaxValue(AttrId, ValIndx, False));
Debug.WriteLine("Minimum value: " + DataSource.GetMinValue(AttrId, ValIndx , False));
// Get data by factor and index of time line with default attribute
Data := DataSource.GetData(ObjectId, ValIndx);
If Data = Null Then
Debug.WriteLine("The GetData method does not return data.")
Else Debug.WriteLine("Value: " + DataSource.GetData(ObjectId, ValIndx));
End If;
// Get data with set attribute from selected object on the set time line step
Data := DataSource.GetDataEx(ObjectId, AttrId, ValIndx);
If Data = Null Then
Debug.WriteLine("The GetDataEx method does not return data.");
Else Debug.WriteLine("Object, value: " + DataSource.ItemsNames.Item(ObjectId) + ", " +
DataSource.GetDataEx(ObjectId, AttrId, ValIndx));
End If;
// Get all data for the set object and factor by the entire time line, after which output value
DataArray := New VZDataArray.Create;
DataArray := DataSource.GetAllObjectData(ObjectId, attrId);
Debug.WriteLine("Value at the third step of time line: " + DataArray.Item(2));
// Get all data at the set attribute and time line step
DataDictionary := New VZDataDictionary.Create;
DataDictionary := DataSource.GetAllLevelDataDictionary(AttrId, ValIndx);
Debug.WriteLine("Value of factor with the 3 index: " + DataDictionary.Item("3"));
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Visualizators;
Imports Prognoz.Platform.Interop.Express;
…
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
EaxAnalyzer: IEaxAnalyzer;
BubbleTree: IVZBubbleTree;
DataSource: IVZMultiplyDataSource;
StringArrayAttr: IVZStringArray;
StringArrayObj: IVZStringArray;
DataArray: IVZDataArray;
DataDictionary: IVZDataDictionary;
AttrId: String;
ValIndx: Integer;
ObjectId: String;
Data: Object;
Begin
// Get repository object
Metabase := Params.Metabase;
// Open express report
EaxAnalyzer := Metabase.ItemById["EXPRESS"].Edit() As IEaxAnalyzer;
// Get bubble tree
BubbleTree := EaxAnalyzer.BubbleTree.BubbleTree;
// Get visualizer data source
DataSource := BubbleTree.ColorVisual.ColorMapping.DataSource;
// Set data source name
DataSource.Title := "Visualizator data source";
// Create and fill array of attributes and data source objects
StringArrayAttr := New VZStringArray.Create();
StringArrayAttr := DataSource.GetAttributes();
StringArrayObj := New VZStringArray.Create();
StringArrayObj := DataSource.GetObjects();
// Get dictionary of bubble tree element names
DataSource.ItemsNames := BubbleTree.Captions;
// Display information about data source
System.Diagnostics.Debug.WriteLine("Data source index: " + DataSource.ID);
System.Diagnostics.Debug.WriteLine("Data source title: " + DataSource.Title);
System.Diagnostics.Debug.WriteLine("Maximum capacity of dimensions (time line): " +
DataSource.MaxTimelineIndex.ToString());
// Get attribute identifier
AttrId := BubbleTree.ColorVisual.ColorMapping.AttributeId;
// Set index with respect to time scale
ValIndx := 0;
// Set object index
ObjectId := "99";
// Get default attribute identifier
System.Diagnostics.Debug.WriteLine("Default attribute identifier: " + DataSource.DefaultAttributeId);
// Determine attribute name by using dictionary of factor names
System.Diagnostics.Debug.WriteLine("Indicator name: " + DataSource.AttributesNames.Item[AttrId]);
// Get maximum and minimum indicator values
System.Diagnostics.Debug.WriteLine("Maximum value: " + DataSource.GetMaxValue(AttrId, ValIndx, False));
System.Diagnostics.Debug.WriteLine("Minimum value: " + DataSource.GetMinValue(AttrId, ValIndx , False));
// Get data by factor and index of time line with default attribute
Data := DataSource.GetData(ObjectId, ValIndx);
If Data = Null Then
System.Diagnostics.Debug.WriteLine("The GetData method does not return data.")
Else System.Diagnostics.Debug.WriteLine("Value: " + DataSource.GetData(ObjectId, ValIndx));
End If;
// Get data with set attribute from selected object on the set time line step
Data := DataSource.GetDataEx(ObjectId, AttrId, ValIndx);
If Data = Null Then
System.Diagnostics.Debug.WriteLine("The GetDataEx method does not return data.");
Else System.Diagnostics.Debug.WriteLine("Object, value: " + DataSource.ItemsNames.Item[ObjectId] + ", " +
DataSource.GetDataEx(ObjectId, AttrId, ValIndx));
End If;
// Get all data for the set object and factor by the entire time line, after which output value
DataArray := New VZDataArray.Create();
DataArray := DataSource.GetAllObjectData(ObjectId, attrId);
System.Diagnostics.Debug.WriteLine("Value at the third step of time line: " + DataArray.Item[2]);
// Get all data at the set attribute and time line step
DataDictionary := New VZDataDictionary.Create();
DataDictionary := DataSource.GetAllLevelDataDictionary(AttrId, ValIndx);
System.Diagnostics.Debug.WriteLine("Value of factor with the 3 index: " + DataDictionary.Item["3"]);
DataSource.
End Sub;
After executing the example the console displays visualizer data source parameter values.
See also: