LookupFactors(Facts: IRubricatorFactsLookup; Observations: IRubricatorObservationsLookup): Array;
Facts - constraints imposed on factors.
Observations - constraints imposed on factors data.
The LookupFactors method searches for factors by conditions specified via the Facts and Observations parameters. It returns the array that contains keys of found factors.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. This database must include a factor attribute with the COUNTRIES identifier.
Sub Main;
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
FactsLookup: IRubricatorFactsLookup;
MetaDLookup: IMetaDictionaryLookup;
ObservLookup: IRubricatorObservationsLookup;
Key: Array Of Integer;
i: Integer;
Cond: IOrmCondition;
Begin
MB := MetabaseClass.Active;
RubDesc := MB.ItemById("OBJ_RUBRICATOR");
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
FactsLookup := RubrIn.CreateFactsLookup;
MetaDLookup := FactsLookup.Lookup;
Cond := MetaDLookup.Where.Add;
Cond.AttributeName := "COUNTRIES";
Cond.Value := 512;
ObservLookup := RubrIn.CreateObservationsLookup(Null);
ObservLookup.WhereCalendarLevel := DimCalendarLevel.Year;
i := RubrIn.LookupFactors(FactsLookup, ObservLookup).Length;
Key := New Integer[i];
Key := RubrIn.LookupFactors(FactsLookup, ObservLookup);
End Sub Main;
After executing the example the Key array contains factors keys that satisfy the following conditions: annual frequency is present in the factor, and the COUNTRIES attribute value equals to 512.
See also: