Transform: Object;
Transform: object;
The Transform property returns object to work with parameters of data transformation formula.
To work with the object returned by this property, it must be transformed to the IMsFormulaTransform interface.
Executing the example requires that the repository contains an express report with the EXPRESS identifier that contains the formula edited in the expression editor.
Add links to the Dimension, Express, Metabase, Ms, Pivot system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
DArea: IEaxDataArea;
DAreaSlice: IEaxDataAreaSlice;
CalcTransformations: IEaxDataAreaTransformations;
CalcTransformation: IEaxDataAreaTransformation;
Transform: IMsFormulaTransform;
GeneratedName: String;
FormulaCount: Integer;
Formula: IMSFormula;
Gen: IMsFormulaStringGenerator;
SelSet: IDimSelectionSet;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get data source slice
DArea := Express.DataArea;
DAreaSlice := DArea.Slices.Item(0);
// Get formula of data transformation in analytical area
CalcTransformations := DAreaSlice.CalcTransformations;
CalcTransformation := CalcTransformations.Item(0);
// Set selection and key of dimension
SelSet := Express.Pivot.Selection;
CalcTransformation.Selection := SelSet;
CalcTransformation.DimKey := Express.Pivot.DimItem(0).Key;
// Display to the console
Debug.WriteLine("Element value - " + CalcTransformation.Element.ToString);
Debug.WriteLine("Element identifier - " + CalcTransformation.ElementId);
Debug.WriteLine("Transformation formula key - " + CalcTransformation.Key.ToString);
// Get and display to the console generated formula name
GeneratedName := CalcTransformation.GeneratedName;
Debug.WriteLine("Generated formula name - " + GeneratedName);
// Display to the console scale of current dimension unit
Debug.WriteLine("Dimension unit scale: " + CalcTransformation.DefaultUnit.ToString);
// Set formula name
CalcTransformation.Name := "TransformFormula";
// Display to the console number of formula calculation methods
Transform := CalcTransformation.Transform As IMsFormulaTransform;
FormulaCount := Transform.FormulaCount;
Debug.WriteLine("Number of calculation methods - " + FormulaCount.ToString);
// Get and display to the console calculation method name
Formula := Transform.FormulaItem(0);
Gen := Formula.CreateStringGenerator;
Gen.ShowFullVariableNames := True;
Debug.WriteLine("Calculation method name - " + Gen.Execute);
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example:
The console displays generated name of data transformation formula, calculated element value, its identifier, transformation formula key.
Formula name is changed.
The console displays dimension unit scale.
The console displays number of formula calculation methods.
The console window displays the name of the formula calculation method.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Pivot;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Express: IEaxAnalyzer;
DArea: IEaxDataArea;
DAreaSlice: IEaxDataAreaSlice;
CalcTransformations: IEaxDataAreaTransformations;
CalcTransformation: IEaxDataAreaTransformation;
Transform: IMsFormulaTransform;
GeneratedName: String;
FormulaCount: Integer;
Formula: IMSFormula;
Gen: IMsFormulaStringGenerator;
SelSet: IDimSelectionSet;
Begin
// Get repository
MB := Params.Metabase;
// Get express report
Express := MB.ItemById["EXPRESS"].Edit() As IEaxAnalyzer;
// Get data source slice
DArea := Express.DataArea;
DAreaSlice := DArea.Slices.Item[0];
// Get formula of data transformation in analytical area
CalcTransformations := DAreaSlice.CalcTransformations;
CalcTransformation := CalcTransformations.Item[0];
// Set selection and key of dimension
SelSet := Express.Pivot.Selection;
CalcTransformation.Selection := SelSet;
CalcTransformation.DimKey := Express.Pivot.DimItem[0].Key;
// Display to the console
System.Diagnostics.Debug.WriteLine("Element value - " + CalcTransformation.Element.ToString());
System.Diagnostics.Debug.WriteLine("Element identifier - " + CalcTransformation.ElementId);
System.Diagnostics.Debug.WriteLine("Transformation formula key - " + CalcTransformation.Key.ToString());
// Get and display to the console generated formula name
GeneratedName := CalcTransformation.GeneratedName;
System.Diagnostics.Debug.WriteLine("Generated formula name - " + GeneratedName);
// Display to the console scale of current dimension unit
System.Diagnostics.Debug.WriteLine("Dimension unit scale: " + CalcTransformation.DefaultUnit.ToString());
// Set formula name
CalcTransformation.Name := "TransformFormula";
// Display to the console number of formula calculation methods
Transform := CalcTransformation.Transform As IMsFormulaTransform;
FormulaCount := Transform.FormulaCount;
System.Diagnostics.Debug.WriteLine("Number of calculation methods - " + FormulaCount.ToString());
// Get and display to the console calculation method name
Formula := Transform.FormulaItem[0];
Gen := Formula.CreateStringGenerator();
Gen.ShowFullVariableNames := True;
System.Diagnostics.Debug.WriteLine("Calculation method name - " + Gen.Execute());
// Save changes
(Express As IMetabaseObject).Save();
End Sub;
See also: