Grouping of Series

Executing the example requires that the repository contains a workbook with the OBJ123 identifier in which series are grouped. A time series database used to create the workbook must contain an attribute with the TERRID identifier, one of its values must be 1.

Add links to the following system assemblies:

Fore Example

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exp: IEaxAnalyzer;
    WB: ILaner;
    TSDB: IRubricator;
    MetaAtt: IMetaAttribute;
    AttrVals: ILanerMetaAttributeValues;
    AttrVal: ILanerMetaAttributeValue;
    GroupSer: ILanerGroupSerie;
Begin
    MB := MetabaseClass.Active;
    //Open a workbook to edit
    MObj := MB.ItemById("OBJ123").Edit;
    Exp := MObj As IEaxAnalyzer;
    //Return the workbook
    WB := Exp.Laner;
    WB.BeginUpdate;
    //Return the database used to create the workbook
    TSDB := WB.RubricatorInstance.Rubricator;
    //Create collection of attributes' values
    AttrVals := WB.Series.CreateMetaAttributeValues;
    //Get attribute with the defined identifier the time database
    MetaAtt := TSDB.Facts.Attributes.FindById("TERRID");
    //Add the attribute to collection of attributes
    AttrVal := AttrVals.Add(MetaAtt);
    //Set attribute value
    AttrVal.Value := 1;
    //Add a group of series in which the value of the TERRID attribute is 1 
    GroupSer := WB.Series.AddGroupSerie(TSDB, AttrVals);
    //Expand the group of series
    GroupSer.Expanded := True;
    WB.EndUpdate;
    MObj.Save;
End Sub UserProc;

After executing the example a new group of series is added to the workbook. The group includes the series, in which the COUNTRY attribute value is 512. The group is expanded.

Fore.NET Example

The defined procedure is the main entry point in the Program module of the .NET assembly. The Express, Metabase, Laner, Rds, Cubes assemblies must be imported to this module from the Prognoz.Platform.Interop system assembly.

Public Shared Sub Main(Params: StartParams);

Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exp: IEaxAnalyzer;
    WB: ILaner;
    TSDB: IRubricator;
    MetaAtt: IMetaAttribute;
    AttrVals: ILanerMetaAttributeValues;
    AttrVal: ILanerMetaAttributeValue;
    GroupSer: ILanerGroupSerie;
Begin
    MB := Params.Metabase;
    //Open a workbook to edit
    MObj := MB.ItemById["OBJ123"].Edit();
    Exp := MObj As IEaxAnalyzer;
    //Return the workbook
    WB := Exp.Laner;
    WB.BeginUpdate();
    //Return the database used to create the workbook
    TSDB := WB.RubricatorInstance.Rubricator;
    //Create collection of attributes' values
    AttrVals := WB.Series.CreateMetaAttributeValues();
    //Get attribute with the defined identifier the time database
    MetaAtt := TSDB.Facts.Attributes.FindById("TERRID");
    //Add the attribute to collection of attributes
    AttrVal := AttrVals.Add(MetaAtt);
    //Set attribute value
    AttrVal.Value := 1;
    //Add a group of series in which the value of the TERRID attribute is 1 
    GroupSer := WB.Series.AddGroupSerie(TSDB, AttrVals, 0, -1);
    //Expand the group of series
    GroupSer.Expanded := True;
    WB.EndUpdate();
    MObj.Save();
    End Sub;

The result of example execution matches with that of the Fore example.

See also:

Examples | ILaner | ILanerMetaAttributeValue | ILanerMetaAttributeValues | ILanerGroupSerie