ConditionJoin: OrmLogicalOperator;
ConditionJoin: Prognoz.Platform.Interop.Orm.OrmLogicalOperator;
The ConditionJoin property determines a logical operator that is used to join the current condition with the previous one.
The logical AND is used by default, that is, ConditionJoin = OrmLogicalOperator.And_.
Executing the example requires that the repository contains a time series database with the TSDB identifier containing an integer attribute of time series with the COUNTRY identifier. The database series should be identified with mnemonics.
Add links to the Cubes, Metabase, Orm, and Rds system assemblies.
Sub UserConditionJoin;
Var
MB: IMetabase;
RubrInst: IRubricatorInstance;
FactsLookup: IRubricatorFactsLookup;
MetaDLookup: IMetaDictionaryLookup;
Conds: IOrmConditions;
Cond_1, Cond_2: IOrmCondition;
Factors: Array;
i: Integer;
Factor: IRubricatorFactor;
FactData: IRubricatorFactData;
Begin
MB := MetabaseClass.Active;
// Get instance of time series database
RubrInst := MB.ItemById("TSDB").Open(Null) As IRubricatorInstance;
// Create an object that is used to search factors
FactsLookup := RubrInst.CreateFactsLookup;
MetaDLookup := FactsLookup.Lookup;
Conds := MetaDLookup.Where;
// Add condition 1
Cond_1 := Conds.Add;
Cond_1.AttributeName := "COUNTRY";
Cond_1.Value := 512;
// Add condition 2
Cond_2 := Conds.Add;
Cond_2.ConditionJoin := OrmLogicalOperator.Or_;
Cond_2.AttributeName := "COUNTRY";
Cond_2.Value := 914;
// Search and display search results in the console window
FactsLookup.Open(DictionaryCursorOptions.None);
Factors := FactsLookup.GetFactors;
If Factors <> Null Then
For i := 0 To Factors.Length - 1 Do
Factor := Factors[i];
FactData := Factor.FactData;
Debug.WriteLine((i + 1).ToString + ". " + FactData.Mnemo);
End For;
End If;
FactsLookup.Close;
End Sub UserConditionJoin;
After executing the example the console window displays mnemonics of the time series corresponding to the conditions: value of the COUNTRY attribute is equal to 512 or 914.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Orm;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RubrInst: IRubricatorInstance;
FactsLookup: IRubricatorFactsLookup;
MetaDLookup: IMetaDictionaryLookup;
Conds: IOrmConditions;
Cond_1, Cond_2: IOrmCondition;
Factors: Array;
i: Integer;
Factor: IRubricatorFactor;
FactData: IRubricatorFactData;
Begin
MB := Params.Metabase;
// Get instance of time series database
RubrInst := MB.ItemById["TSDB"].Open(Null) As IRubricatorInstance;
// Create an object that is used to search factors
FactsLookup := RubrInst.CreateFactsLookup();
MetaDLookup := FactsLookup.Lookup;
Conds := MetaDLookup.Where;
// Add condition 1
Cond_1 := Conds.Add();
Cond_1.AttributeName := "COUNTRY";
Cond_1.Value := 512;
// Add condition 2
Cond_2 := Conds.Add();
Cond_2.ConditionJoin := OrmLogicalOperator.oloOr;
Cond_2.AttributeName := "COUNTRY";
Cond_2.Value := 914;
// Search and display search results in the console window
FactsLookup.Open(DictionaryCursorOptions.dcuoNone);
Factors := FactsLookup.GetFactors();
If Factors <> Null Then
For i := 0 To Factors.Length - 1 Do
Factor := Factors.GetValue(i) As IRubricatorFactor;
FactData := Factor.FactData;
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + ". " + FactData.Mnemo);
End For;
End If;
FactsLookup.Close();
End Sub;
See also: