IndexOf(Value: IEaxDataAreaTransformation): Integer;
IndexOf(Value: Prognoz.Platform.Interop.Express.IEaxDataAreaTransformation): integer;
Value. Data transformation formula.
The IndexOf method returns index of the specified data transformation formula.
To move data transformation formula inside collection, use IEaxDataAreaTransformations.MoveTo.
Executing the example requires that the repository contains an express report with the EXPRESS identifier containing table. The table contains two formatted formulas.
Add links to the Dimensions, Express, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
TrsCalc: IEaxDataAreaTransformations;
TrCalc_a, TrCalc_b: IEaxDataAreaTransformation;
SelSet: IDimSelectionSet;
TransArray: IEaxTransformationTargetsArray;
i: Integer;
Tr: IEaxDataAreaTransformation;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get data slice
Slice := Express.DataArea.Slices.Item(0);
// Get collection of data transformation formulas
TrsCalc := Slice.CalcTransformations;
// Get data transformation formulas
TrCalc_a := TrsCalc.Item(0);
TrCalc_b := TrsCalc.Item(1);
// Move indexes of data transformation formulas
TrsCalc.MoveTo(1, 0);
// Display to the console
Debug.WriteLine
("Index of moved data transformation formula = " + TrsCalc.IndexOf(TrCalc_b).ToString);
// Get selection and display elements of dimension for which formula is set
SelSet := TrsCalc.TransformationsSelection;
Debug.WriteLine("Elements in selection - " + SelSet.Item(0).ToString("", ", ", False));
// Display to the console expression transforming data
TransArray := TrsCalc.TransformationElements(Null);
For i := 0 To TransArray.Count - 1 Do
Tr := TransArray.Transformation(i);
Debug.WriteLine("Data transformation formula - " + Tr.Expression.AsString);
End For;
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example:
Data transformation formulas exchange indexes.
The console displays index of moved formula.
The console displays elements for which data transformation formula is set.
The console displays expressions of data transformation for all elements.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
TrsCalc: IEaxDataAreaTransformations;
TrCalc_a, TrCalc_b: IEaxDataAreaTransformation;
SelSet: IDimSelectionSet;
TransArray: IEaxTransformationTargetsArray;
i: Integer;
Tr: IEaxDataAreaTransformation;
Begin
// Get repository
MB := Params.Metabase;
// Get express report
Express := MB.ItemById["EXPRESS"].Edit() As IEaxAnalyzer;
// Get data slice
Slice := Express.DataArea.Slices.Item[0];
// Get collection of data transformation formulas
TrsCalc := Slice.CalcTransformations;
// Get data transformation formulas
TrCalc_a := TrsCalc.Item[0];
TrCalc_b := TrsCalc.Item[1];
// Move indexes of data transformation formulas
TrsCalc.MoveTo(1, 0);
// Display to the console
System.Diagnostics.Debug.WriteLine
("Index of moved data transformation formula = " + TrsCalc.IndexOf(TrCalc_b).ToString());
// Get selection and display elements of dimension for which formula is set
SelSet := TrsCalc.TransformationsSelection;
System.Diagnostics.Debug.WriteLine("Elements in selection - " + SelSet.Item[0].ToString("", ", ", False));
// Display to the console expression transforming data
TransArray := TrsCalc.TransformationElements[Null];
For i := 0 To TransArray.Count - 1 Do
Tr := TransArray.Transformation[i];
System.Diagnostics.Debug.WriteLine("Data transformation formula - " + Tr.Expression.AsString);
End For;
// Save changes
(Express As IMetabaseObject).Save();
End Sub;
See also: