Params: IMsModelParams;
The Params property returns the set of validation filter parameters.
Parameter values are set in the object, created by the IValidationFilter.CreateExecuteSettings method.
Executing the example requires a form containing the WorkbookDocumentViewerBox component with the WorkbookDocumentViewerBox1 identifier and the UiErAnalayzer component with the UiErAnalyzer1 identifier. UiErAnalyzer1 is a data source for WorkbookDocumentViewerBox1 and contains a time series database workbook with the TSDB_VALIDATION_PARAMETERS identifier. Time series database parameters:
The mandatory series attribute with the CITY identifier referring to the dictionary.
A validation rule with the VALIDATION_TREND identifier of the Compare Trends type.
Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
LinkedDict: IMetabaseObjectDescriptor;
Dim: IDimInstance;
DimSel: IDimSelection;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Params: IMsModelParams;
ComparPrarm: IMsModelParam;
Trend: IValidationTrend;
Comparator: IValidationSelectionValueList;
ComparVal: IValidationSelectionValue;
ExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ParamVals: IMsModelParamValues;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := MetabaseClass.Active;
// Get time series database
FCObj := mb.ItemById("TSDB_VALIDATION_PARAMETERS").Bind;
FC := FCObj As IRubricator;
//Get dictionary to which the "CITY" attribute is referred
LinkedDict := FC.Facts.Attributes.FindById("CITY").ValuesObject;
Dim := LinkedDict.Open(Null) As IDimInstance;
DimSel := Dim.CreateSelection;
//Get validation rule
ValidObj := Mb.ItemByIdNamespace("VALIDATION_TREND", FCObj.Key).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Get validation rule parameters
Params := ValidFilter.Params;
Params.Clear;
// Add parameter for comparison expression
ComparPrarm := Params.Add;
ComparPrarm.Id := "COMPAR_CITY";
ComparPrarm.Name := "City for comparison block";
ComparPrarm.LinkedObject := LinkedDict;
// Set comparison expression
Trend := ValidFilter.Details As IValidationTrend;
Comparator := Trend.SelectionComparatorData;
Comparator.Clear;
ComparVal := Comparator.Add(DimSel);
ComparVal.Parameter := ComparPrarm;
// Clear validation filter
Trend.SelectionFilter.Clear;
// Save validation rule
ValidObj.Save;
// Get rule execution parameters
ExecSett := ValidFilter.CreateExecuteSettings;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ExecSett.Laner := Analyzer.Laner;
// Set parameter values
ParamVals := ExecSett.ParamValues;
DimSel.DeselectAll;
DimSel.SelectElement(1, False);
ParamVals.FindById("COMPAR_CITY").Value := DimSel.ToVariant;
// Execute validation rule
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;
After executing the example the series, which trend is used for comparison, is changed for the VALIDATION_TREND validation rule. The compared series is set by the COMPAR_CITY parameter determining value of the CITY mandatory attribute. The rule is executed for the workbook displayed in WorkbookDocumentViewerBox1.
See also: