FactDataId: String;
The FactDataId property determines identifiers of factor attributes that are used to save or load values.
Attributes identifiers are separated with semicolon ;.
NOTE. If during storage some attribute, collected when extracting data, must be skipped, the attribute is not indicated in this property and is replaced with delimiter ;.
Example: the following attribute list is indicated to extract data: FactDataId:=ATTR1;ATTR2;ATTR3. To save data by the third attribute only, set the following value in this property: FactDataId:=;;ATTR3.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. The following additional attributes are created in the database:
COUNTRY - attribute that refers to the countries dictionary.
USER_ATTR - user attribute containing any integer type data.
Sub Main;
Var
MB: IMetabase;
RubInst: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Exe: ICubeInstanceDestinationExecutor;
Mat, DataMatr: IMatrix;
It: IMatrixIterator;
i: Integer;
Sto: ICubeInstanceStorage;
Begin
MB := MetabaseClass.Active;
RubInst := MB.ItemById("OBJ_RUBRICATOR").Open(Null) As IRubricatorInstance;
Cub := RubInst As ICubeInstance;
Dest := Cub.Destinations.DefaultDestination;
Exe := Dest.CreateExecutor;
//Time series attributes
(Exe As IRubricatorFactorIO).FactDataId := "FACTOR;COUNTRY;USER_ATTR";
//Observation attributes
(Exe As IRubricatorFactorIO).ValueId := "FACTOR;VL";
Exe.PrepareExecute(Null);
Exe.PerformExecute;
Mat := Exe.Matrix;
//Matrix
DataMatr := (CubeClass.ExecuteResult(Mat) As IRubricatorExecuteResult).Factors;
It := DataMatr.CreateIterator;
It.Move(IteratorDirection.First);
While It.Valid Do
//Search for time series with indicated attributes values
If (It.Values(1) = 94) And (It.Values(2) = 1) Then
i := It.Values(0);
Break;
End If;
It.Move(IteratorDirection.Next);
End While;
Mat.ValueFlag := 1;
DataMatr := (CubeClass.ExecuteResult(Mat) As IRubricatorExecuteResult).Values;
It := DataMatr.CreateIterator;
It.Move(IteratorDirection.First);
While It.Valid Do
//Search for all the values by found time series and change them for one
If It.Values(0) = i Then
It.Values(1) := (It.Values(1) As Double) + 1;
It.ValueFlag := 1;
Else
It.ValueFlag := 0;
End If;
It.Move(IteratorDirection.Next);
End While;
Sto := Dest.CreateStorage;
(Sto As IRubricatorFactorIO).ValueId := ";VL";
//Save new values
Sto.SaveMatrix(Mat, 1);
End Sub Main;
After executing the example data by factors attributes FACTOR, COUNTRY and USER_ATTR is obtained. The factor, for which the COUNTRY attribute value equals to 94 and the USER_ATTR attribute value equals to 1, is found. All the values are increased by one by the found factor. Updated data is saved to the time series database.
See also: