ScenarioKey: Integer;
ScenarioKey: uinteger;
The ScenarioKey property determines the scenario key, by which validation should be calculated.
By default the ScenarioKey takes value -1, that is, validation is calculated based on actual data (the Fact scenario).
The calculation on scenario data is available for validations working with data and not metadata.
Executing the example requires a form, a button named Button1 on it, the LanerBox component and the UiErAnalyzer component named UiErAnalyzer1 that is a data source for LanerBox. Workspace of the OBJ_FC time series database must be loaded to UiErAnalyzer1. The time series database should contain a validation filter of the Compare with Number type with the OBJ_VALID_FILTER identifier.
Add links to the Metabase, Ms, Cubes, Rds system assemblies. This example is the OnClick event handler for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);;
Var
Mb: IMetabase;
RubrKey: Integer;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
ValidExecSett: IValidationExecuteSettings;
ValidExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
MetaAttrValList: IMsMetaAttributeValueList;
Rub: IRubricator;
Analyzer: IEaxAnalyzer;
Begin
Mb := MetabaseClass.Active;
RubrKey := Mb.GetObjectKeyById("OBJ_FC");
ValidObj := Mb.ItemByIdNamespace("OBJ_VALID_FILTER", RubrKey).Edit;
ValidFilter := ValidObj As IValidationFilter;
ValidFilter.Kind := ValidationDetailsKind.Level;
Level := ValidFilter.Details As IValidationLevel;
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.More;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := -0.3;
Rub := Mb.ItemById("OBJ_FC").Bind As IRubricator;
MetaAttrValList := Level.TargetData;
MetaAttrValList.ScenarioKey := 1;
ValidObj.Save;
ValidExecSett := New ValidationExecuteSettings.Create;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ValidExecSett.Laner := Analyzer.Laner;
ValidExecRun := ValidFilter.Execute(ValidExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ValidExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub Button1OnClick;
After executing the example the Compare with Number validation filter is adjusted: series scenario data greater than -0.3 is filtered (scenario key 1). This filter is applied to the loaded workspace.
Executing the example requires a .NET form, a button named Button1 on it, the LanerBoxNET component and the UiErAnalyzerNET1 component named UiErAnalyzerNET1 that is a data source for LanerBoxNET. The workspace of the time series database OBJ_FC must be loaded to the UiErAnalyzerNet1 component. The time series database should contain a validation filter of the Compare with Number type with the OBJ_VALID_FILTER identifier.
This example is the OnClick event handler for the Button1 component.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Express;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Mb: IMetabase;
RubrKey: uinteger;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
ValidExecSett: ValidationExecuteSettings;
ValidExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
MetaAttrValList: IMsMetaAttributeValueList;
Rub: IRubricator;
Analyzer: EaxAnalyzer;
Begin
Mb := Self.Metabase;
RubrKey := Mb.GetObjectKeyById("OBJ_FC");
ValidObj := Mb.ItemByIdNamespace["OBJ_VALID_FILTER", RubrKey].Edit();
ValidFilter := ValidObj As IValidationFilter;
ValidFilter.Kind := ValidationDetailsKind.vdkLevel;
Level := ValidFilter.Details As IValidationLevel;
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoMore;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := -0.3;
Rub := Mb.ItemById["OBJ_FC"].Bind() As IRubricator;
MetaAttrValList := Level.TargetData;
MetaAttrValList.ScenarioKey := 1 As uinteger;
ValidObj.Save();
ValidExecSett := New ValidationExecuteSettings.Create();
Analyzer := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
ValidExecSett.Laner := Analyzer.Laner;
ValidExecRun := ValidFilter.Execute(ValidExecSett);
DiagRep := New DiagnosticReport.Create();
DiagRep.Run := ValidExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub;
After executing the example the Compare with Number validation filter is adjusted: series scenario data greater than -0.3 is filtered (scenario key 1). This filter is applied to the loaded workspace.
See also: