Parameter: IMsModelParam;
The Parameter property determines the parameter that sets the attribute value.
The IMsMetaAttributeValue.IsParameter property determines whether the attribute is parameter.
Executing the example requires a form, containing the LanerBox component with the LanerBox1 identifier and the UiErAnalayzer component with the UiErAnalyzer1 identifier. UiErAnalyzer1 is a data source for LanerBox1 and contains loaded workbook of the time series database with the TSDB_70 identifier. Database parameters:
The mandatory factor attribute with the COUNTRY identifier referring to the dictionary.
The validation filter with the VALIDATION_COMPARPARAM identifier of the Compare Trends type.
Add links to the Metabase, Ms, Cubes, Rds system assemblies.
Sub AddComparPrarm;
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Params: IMsModelParams;
ComparPrarm: IMsModelParam;
Comparator: IMsMetaAttributeValueList;
ComparVal: IMsMetaAttributeValue;
ExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ParamVals: IMsModelParamValues;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := MetabaseClass.Active;
// Get time series database
FCObj := mb.ItemById("TSDB_70").Bind;
FC := FCObj As IRubricator;
//Get dictionary, to which the COUNTRY attribute refers
Atts := FC.GetDictionary(RubricatorDictionary.Facts).Attributes;
LinkedDict := Atts.FindById("COUNTRY").ValuesObject;
//Get validation filter
ValidObj := Mb.ItemByIdNamespace("VALIDATION_COMPARPARAM", FCObj.Key).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Get validation filter parameters
Params := ValidFilter.Params;
Params.Clear;
// Add parameter for comparison expression
ComparPrarm := Params.Add;
ComparPrarm.Id := "COMPAR_COUNTRY";
ComparPrarm.Name := "Country for the comparison block";
ComparPrarm.LinkedObject := LinkedDict;
// Set comparison expression
Comparator := (ValidFilter.Details As IValidationTrend).ComparatorData;
Comparator.Clear;
ComparVal := Comparator.Add(Atts.FindById("COUNTRY"));
ComparVal.Parameter := ComparPrarm;
// Save validation filter
ValidObj.Save;
// Set filter execution parameters
ExecSett := ValidFilter.CreateExecuteSettings;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ExecSett.Laner := Analyzer.Laner;
// Set parameter values
ParamVals := ExecSett.ParamValues;
ParamVals.FindById("COMPAR_COUNTRY").Value := 512;
// Execute validation filter
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub AddComparPrarm;
Example execution result: the series, the trend of which it is compared with, is changed, for the VALIDATION_COMPARPARAM validation filter. The compared series is set by the COMPAR_COUNTRY parameter, determining the value of the COUNTRY obligatory value. The filter is executed for the workbook displayed in LanerBox1.
See also: