IndexOf(Value: IEaxDataAreaTransformation): Integer;
Value. Data transformation formula.
The IndexOf method returns index of the specified data transformation formula.
To move data transformation formula inside the collection, use IEaxDataAreaTransformations.MoveTo.
Executing the example requires that the repository contains an express report with the EXPRESS identifier containing a 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 the 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 in the console window
Debug.WriteLine
("Index of moved data transformation formula = " + TrsCalc.IndexOf(TrCalc_b).ToString);
// Get selection and display dimension elements, for which formula is set up
SelSet := TrsCalc.TransformationsSelection;
Debug.WriteLine("Selection elements - " + SelSet.Item(0).ToString("", ", ", False));
// Display expression that transforms data in the console window
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 the elements, for which data transformation formula is set.
The console displays expressions of data transformation for all elements.
See also: