IRubricatorSegment.AsObject

Syntax

AsObject: IMetabaseObjectDescriptor;

Description

The AsObject method returns a temporary object for security descriptor editing.

Example

Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier, that contains an attribute of the data series with the COUNTRY identifier that refers to a dictionary.

Sub Main;

Var

mb: IMetabase;

rubInst: IRubricatorInstance;

Rub: IRubricator;

Segs: IRubricatorSegments;

Seg: IRubricatorSegment;

Sd: ISecurityDescriptor;

mbSec: IMetabaseSecurity;

User: IMetabaseUser;

Attr: IMetaAttribute;

Dict: IMetabaseObject;

DI: IDimInstance;

Sel: IDimSelection;

segmFact: IRubricatorFactorsSegment;

segmObject: IMetabaseObjectDescriptor;

Begin

mb := MetabaseClass.Active;

Rub := mb.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;

rubInst := (Rub As IMetabaseObjectDescriptor).Open(Null) As IRubricatorInstance;

Segs := rubInst.Segments;

Seg := Segs.CreateFactorsSegment As IRubricatorSegment;

segmObject := Seg.AsObject;

Sd := segmObject.SecurityDescriptor;

Sd.Edit;

mbSec := MB.Security;

User := mbSec.ResolveName("ADMIN") As IMetabaseUser;

Debug.WriteLine(sd.GetEffectiveRights(User));

Seg.AttributeName := "COUNTRY";

Attr := Rub.Facts.Attributes.FindById("COUNTRY");

Seg.Attribute := Attr;

Dict := Attr.ValuesObject.Bind;

DI := Dict.Open(Null) As IDimInstance;

Sel := DI.CreateSelection;

Sel.SelectElement(0, False);

Sel.SelectElement(1, False);

segmFact := Seg As IRubricatorFactorsSegment;

segmFact.SetSelection(Sel);

Seg.Save;

End Sub Main;

After executing the example a segment that represents a data range is created in the time series database. This segment includes the first and the second dictionary elements, to which the COUNTRY attribute refers. The console window displays effective permissions of the ADMIN user.

See also:

IRubricatorSegment