ParameterAsSelection: IMsModelParam;
ParameterAsSelection: Prognoz.Platform.Interop.Ms.IMsModelParam;
The ParameterAsSelection property determines the parameter used to transfer the element selection used for validation calculation.
To set the parameter value, use the IValidationExecuteSettings.ParamValues property.
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_FILTER identifier of the Compare Trends type.
Add links to the Metabase, Ms, Cubes, Rds system assemblies.
The example is the function for adding a parameter to the validation filter. The parameter limits the filtered series set. Function input parameters:
IsGroup. It determines whether the parameter value is the group of elements. True - the parameter value is the group of elements. False - the parameter value is the elements selection.
Value. Parameter value.
Sub AddFilterParam(IsGroup: Boolean; Value: Variant);
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Params: IMsModelParams;
FilterPrarm: IMsModelParam;
Filter: IMsMetaAttributeFilter;
FilterVal: IMsMetaAttributeValues;
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_FILTER", FCObj.Key).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Get validation filter parameters
Params := ValidFilter.Params;
Params.Clear;
// Add parameter for elements filtering
FilterPrarm := Params.Add;
FilterPrarm.Id := "FILTER_COUNTRY";
FilterPrarm.Name := "Country for filter";
FilterPrarm.LinkedObject := LinkedDict;
// Set validation filter
Filter := (ValidFilter.Details As IValidationTrend).Filter;
Filter.Clear;
FilterVal := Filter.Add(Atts.FindById("COUNTRY"));
If IsGroup Then
FilterVal.ParameterAsGroup := FilterPrarm;
Else
FilterVal.ParameterAsSelection := FilterPrarm;
End If;
// 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("FILTER_COUNTRY").Value := Value;
// Execute validation filter
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub AddFilterParam;
Example execution result: for the VALIDATION_FILTER validation filter series set, for which the filter is executed, is changed. Filtered series are set by the COMPAR_COUNTRY parameter determining value of the COUNTRY mandatory attribute. The filter is executed for the workbook displayed in LanerBox1.
Executing the example requires a .NET form containing the LanerBoxNet component with the LanerBoxNet1 identifier and the UiErAnalayzerNet component with the UiErAnalyzerNet1 identifier. The uiErAnalyzerNet1 is a data source for lanerBoxNet1 and contains an loaded workbook of the time series database with the TSDB_70 identifier. Other requirements match with the requirements of the Fore example execution.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Express;
…
Sub AddFilterParam(IsGroup: Boolean; Value: object);
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Params: IMsModelParams;
FilterPrarm: IMsModelParam;
Filter: IMsMetaAttributeFilter;
FilterVal: IMsMetaAttributeValues;
ExecSett: ValidationExecuteSettings;
Analyzer: EaxAnalyzer;
ParamVals: IMsModelParamValues;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := Self.Metabase;
// 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.rubdicFacts, RubricatorDictionaryOperation.rubdicopNone).Attributes;
LinkedDict := Atts.FindById("COUNTRY").ValuesObject;
//Get validation filter
ValidObj := Mb.ItemByIdNamespace["VALIDATION_FILTER", FCObj.Key].Edit();
ValidFilter := ValidObj As IValidationFilter;
// Get validation filter parameters
Params := ValidFilter.Params;
Params.Clear();
// Add parameter for elements filtering
FilterPrarm := Params.Add();
FilterPrarm.Id := "FILTER_COUNTRY";
FilterPrarm.Name := "Country for filter";
FilterPrarm.LinkedObject := LinkedDict;
// Set validation filter
Filter := (ValidFilter.Details As IValidationTrend).Filter;
Filter.Clear();
FilterVal := Filter.Add(Atts.FindById("COUNTRY"));
If IsGroup Then
FilterVal.ParameterAsGroup := FilterPrarm;
Else
FilterVal.ParameterAsSelection := FilterPrarm;
End If;
// Save validation filter
ValidObj.Save();
// Set filter execution parameters
ExecSett := ValidFilter.CreateExecuteSettings();
Analyzer := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
ExecSett.Laner := Analyzer.Laner;
// Set parameter values
ParamVals := ExecSett.ParamValues;
ParamVals.FindById("FILTER_COUNTRY").Value := Value;
// Execute validation filter
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create();
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub AddFilterParam;
Fore.NET example execution result matches with that of the Fore example.
See also: