IValidationUserComponent.Transform

Fore Syntax

Transform: IMsFormulaTransform;

Fore.NET Syntax

Transform: Prognoz.Platform.Interop.Ms.MsFormulaTransform;

Description

The Transform property determines the formula, based on which the component is set up.

Comments

The property is taken into account if IValidationUserComponent.Kind = ValidationUserComponentKind.Transform.

The formula can be set only for validation implemented by the IValidationRatio or IValidationCustom interface.

Fore Example

Executing the example requires that the repository contains a time series database with the FC_COMM identifier. The database contains the validation filter Ratio of Series Point Values with the VALIDATION_F identifier. The database must also contain two mandatory attributes referring to a dictionary.

For correct execution of example add links to the Metabase, Ms, Cubes, Dimensions system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RubrDescr: IMetabaseObjectDescriptor;
    val: IValidationFilter;
    UserComponents: IValidationUserComponents;
    usComponent: IValidationUserComponent;
    selset: IDimSelectionSet;
    stub: IVariableStub;
    ftransform: IMsFormulaTransform;
    selector: IMsFormulaTransformSelector;
    slice: IMsFormulaTransformSlice;
    formula: IMsFormula;
    determ: IMsDeterministicTransform;
    dimInstDescr: IMetabaseObjectDescriptor;
    dimInst: IDimInstance;
    sel: IDimSelection;
    selSetF: IDimSelectionSetFactory;
Begin
    mb := MetabaseClass.Active;
    RubrDescr := mb.ItemById("FC_COMM");
    stub := RubrDescr.Bind As IVariableStub;
    val := mb.ItemByIdNamespace("VALIDATION_F", RubrDescr.Key).Edit As IValidationFilter;
    UserComponents := val.UserComponents;
    If UserComponents.Count > 0 Then
        usComponent := UserComponents.Item(0);
    Else
        usComponent := UserComponents.Add;
    End If;
    usComponent.Kind := ValidationUserComponentKind.Transform;
    usComponent.Transform := New MsFormulaTransform.Create(MetabaseClass.Active);
    ftransform := usComponent.Transform;
    selector := ftransform.CreateSelector;
    selSetF := New DimSelectionSetFactory.Create;
    selset := selSetF.CreateDimSelectionSet;
    dimInstDescr := stub.Dimension(0As IMetabaseObjectDescriptor;
    dimInst := dimInstDescr.Open(NullAs IDimInstance;
    sel := selset.Add(dimInst);
    sel.SelectAll;
    dimInstDescr := stub.Dimension(1As IMetabaseObjectDescriptor;
    dimInst := dimInstDescr.Open(NullAs IDimInstance;
    sel := selset.Add(dimInst);
    sel.SelectAll;
    slice := ftransform.Outputs.Add(stub).Slices.Add(selset);
    selector.Slice := slice;
    formula := ftransform.Transform(selector);
    formula.Kind := MsFormulaKind.Deterministic;
    determ := formula.Method As IMsDeterministicTransform;
    determ.Expression.AsString := "10";
    (val As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the first custom component of validation is changed. If the component was missing, it is added. The component is set up by formula. All changes in validation filter are saved.

See also:

IValidationUserComponent