Group: IDimElementGroup;
Group: Prognoz.Platform.Interop.Dimensions.IDimElementGroup;
The Group property determines a group of elements available to link.
The group must belong to the same dictionary as the dictionary attribute, with which link is established. This attribute is determined in the IRdsLink.Reference property. If the group belongs to the different dictionary, an exception is thrown.
If the group is determined while creating/editing an element of the dictionary, only those elements that were included in the specified group are displayed in the value of the linked attribute.
Executing the example requires an MDM repository with the RDS_REPO identifier. The repository contains MDM dictionaries with the DICT_1 and DICT_2 identifiers. The DICT2 dictionary contains a group of elements with the GROUP_EL identifier.
Add links to the Metabase, Rds, Dimensions, Dal system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Rds: IMetabaseObjectDescriptor;
MObj, MObj2: IMetabaseObject;
Dict, Dict2: IRdsDictionary;
Attrs: IRdsAttributes;
LinkAttr: IRdsAttribute;
Link: IRdsLink;
Group: IDimElementGroup;
Begin
MB := MetabaseClass.Active;
Rds := MB.ItemById("RDS_REPO");
MObj := MB.ItemByIdNamespace("DICT1", Rds.Key).Edit;
Dict := MObj As IRdsDictionary;
MObj2 := MB.ItemByIdNamespace("DICT2", Rds.Key).Bind;
Dict2 := MObj2 As IRdsDictionary;
//Get attributes of the dictionary Dict1
Attrs := Dict.Attributes;
//Create attribute to link with the dictionary Dict2
LinkAttr := Attrs.Add;
LinkAttr.DataType := DbDataType.Integer;
LinkAttr.Id := "LinkAttr";
LinkAttr.Name := Attribute to link;
//Create link with the dictionary Dict2
Link := Dict.Links.Add;
Link.Attribute := LinkAttr;
Link.Reference := Dict2.Attributes.Key;
Link.Id := "Link";
Link.Name := Link with the dictionary Dict_2;
//Get group of the dictionary Dict2
Group := MB.ItemByIdNamespace("GROUP_EL", MObj2.Key).Bind As IDimElementGroup;
//Connect by group
Link.Group := Group;
//Save changes in the dictionary Dict1
MObj.Save;
End Sub UserProc;
After executing the example the attribute used to connect by the KEY attribute with the DICT2 dictionary is created in the DICT1 dictionary. Only elements included in the GROUP_EL group of the DICT2 dictionary are available for connection.
Executing the example requires an MDM repository with the RDS_REPO identifier. The repository contains MDM dictionaries with the DICT_1 and DICT_2 identifiers. The DICT2 dictionary contains a group of elements with the GROUP_EL identifier.
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Rds: IMetabaseObjectDescriptor;
MObj, MObj2: IMetabaseObject;
Dict, Dict2: IRdsDictionary;
Attrs: IRdsAttributes;
LinkAttr: IRdsAttribute;
Link: IRdsLink;
Group: IDimElementGroup;
Begin
MB := Params.Metabase;
Rds := MB.ItemById["OBJ601"];
MObj := MB.ItemByIdNamespace["RDS_DICT", Rds.Key].Edit();
Dict := MObj As IRdsDictionary;
MObj2 := MB.ItemByIdNamespace["DICT_LINKED", Rds.Key].Bind();
Dict2 := MObj2 As IRdsDictionary;
//Get attributes of the dictionary Dict1
Attrs := Dict.Attributes;
//Create attribute to link with the dictionary Dict2
LinkAttr := Attrs.Add();
LinkAttr.DataType := DbDataType.ddtInteger;
LinkAttr.Id := "LinkAttr";
LinkAttr.Name := Attribute to link;
//Create link with the dictionary Dict2
Link := Dict.Links.Add();
Link.Attribute := LinkAttr;
Link.Reference := Dict2.Attributes.Key;
Link.Id := "Link";
Link.Name := Link with the dictionary Dict_2;
//Get group of the dictionary Dict2
Group := MB.ItemByIdNamespace["GROUP_MO", MObj2.Key].Bind() As IDimElementGroup;
//Connect by group
Link.Group := Group;
//Save changes in the dictionary Dict1
MObj.Save();
End Sub;
After executing the example the attribute used to connect by the KEY attribute with the DICT2 dictionary is created in the DICT1 dictionary. Only elements included in the GROUP_EL group of the DICT2 dictionary are available for connection.
See also: