Transform: IMsFormulaTransform;
The Transform property returns an object containing validation rule settings.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier.
Sub Main;
Var
mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
Rubr: IRubricator;
Info: IMetabaseObjectCreateInfo;
Descr: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
Validation: IValidation;
Transform: IMsFormulaTransform;
Outputs: IMsFormulaTransformVariables;
Output: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
AttrValueList: IMsMetaAttributeValueList;
Attribute: IMetaAttribute;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Begin
mb := MetabaseClass.Active;
RubrDescr := mb.ItemById("OBJ_RUBRICATOR");
Rubr := RubrDescr.Bind As IRubricator;
Info := mb.CreateCreateInfo;
Info.Parent := RubrDescr;
Info.ClassId := MetabaseObjectClass.KE_CLASS_VALIDATION;
Descr := mb.CreateObject(Info);
Obj := Descr.Edit;
Obj.Description := "Label at " + DateTime.Now.ToString;
Obj.Id := "VALIDATION";
Obj.Name := "VALIDATION";
Validation := Obj As IValidation;
Transform := Validation.Transform;
Outputs := Transform.Outputs;
Output := Outputs.Count = 0 ? Outputs.Add(Null) : Outputs.Item(0);
Slice := Output.Slices.Add(Null);
AttrValueList := Slice.MetaAttributeValueList;
AttrValueList.Clear;
Attribute := Rubr.Facts.Attributes.FindById("REV");
AttrValueList.Add(Attribute);
Selector := Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Transform.Transform(Selector) As IMsFormula;
Formula.Kind := MsFormulaKind.Deterministic;
Formula.Level := DimCalendarLevel.Year;
(Formula.Method As IMsDeterministicTransform).Expression.AsString := "x[t] <> 0";
Obj.Save;
End Sub Main;
After executing the example a validation rule is created in the time series database.
See also: