OutputParameter: IMsModelParam;
The OutputParameter property determines output parameter.
Output parameter is used to calculate validation rules.
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 loaded workbook of the time series database with the TSDB identifier. Time series database parameters:
The mandatory time series attribute with the CITY identifier referring to the dictionary.
A validation rule with the VALIDATION_COMPARPARAM identifier of the Compare Trends type.
Add links to the Cubes, Dimensions, Metabase, Ms, Rds, Stat system assemblies.
Sub UserProc;
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
ParamProvider: IMsParamProvider;
Params: IMsModelParams;
ComparPrarm: IMsModelParam;
ExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ParamVals: IMsModelParamValues;
DimSel: IDimSelection;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Filter: IMsMetaAttributeFilter;
FilterVal: IMsMetaAttributeValues;
Begin
mb := MetabaseClass.Active;
// Get time series database
FCObj := mb.ItemById("TSDB").Bind;
FC := FCObj As IRubricator;
//Get a dictionary to which the "CITY" attribute refers
Atts := FC.GetDictionary(RubricatorDictionary.Facts).Attributes;
LinkedDict := Atts.FindById("CITY").ValuesObject;
//Get validation rule
ValidObj := Mb.ItemByIdNamespace("VALIDATION_COMPARPARAM", FCObj.Key).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Get validation rule parameters
Analyzer := UiErAnalyzer1.ErAnalyzer;
ValidFilter.ParamProvider := Analyzer.ParamProvider As IMsParamProvider;
ParamProvider := ValidFilter.ParamProvider;
Params := ParamProvider.Params;
Params.Clear;
// Add filtering parameter
ComparPrarm := Params.Add;
ComparPrarm.Id := "COMPAR_CITY";
ComparPrarm.Name := "City for filtering block";
ComparPrarm.LinkedObject := LinkedDict;
ComparPrarm.ParamType := TsParamType.Selection;
// Save validation rule
ValidObj.Save;
// Set rule execution parameters
ExecSett := ValidFilter.CreateExecuteSettings;
ExecSett.Laner := Analyzer.Laner;
// Set filter
Filter := ExecSett.Filter;
Filter.Clear;
FilterVal := Filter.Add(Atts.FindById("CITY"));
FilterVal.OutputParameter := ComparPrarm;
// Set parameter values
ParamVals := ExecSett.ParamValues;
DimSel := (LinkedDict.Open(Null) As IDimInstance).CreateSelection;
DimSel.SelectElement(1, False);
ParamVals.FindById("COMPAR_CITY").Value := DimSel;
// Execute validation rule
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;
Example execution parameter: filter is set for the VALIDATION_COMPARPARAM validation rule. Filtering 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: