Expression(Param: IRdsParam): IExpression;
Expression[Prognoz.Platform.Interop.Rds.IRdsParam] : Prognoz.Platform.Interop.ForeSystem.IExpression;
Param. Parameter of a linked dictionary, for which it is necessary to determine a value.
The Expression property returns an expression that determines a permanent value of a parameter of a linked dictionary.
Executing the example requires the MDM repository with the NSI_1 identifier that contains MDM dictionaries with the Dict_1 and Dict_2 identifiers. The second dictionary has one parameter. Add links to the Metabase, Dal and Rds system assemblies.
Sub Macro;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict, Dict2: IRdsDictionary;
Attrs: IRdsAttributes;
LinkAttr: IRdsAttribute;
Link: IRdsLink;
Param: IRdsParam;
ParamsControl: IRdsParamsControl;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;
Dict := MObj As IRdsDictionary;
Dict2 := MB.ItemByIdNamespace("Dict_2", MB.ItemById("NSI_1").Key).Bind As IRdsDictionary;
//Attributes of the first dictionary
Attrs := Dict.Attributes;
//Attribute for linking with the dictionary
LinkAttr := Attrs.Add;
LinkAttr.DataType := DbDataType.Integer;
LinkAttr.Id := "LinkAttr";
LinkAttr.Name := Link attribute;
//Link with the parameterized dictionary
Link:= Dict.Links.Add;
Link.Attribute := LinkAttr;
Link.Reference := Dict2.Attributes.Key;
Link.Id := "Link";
Link.Name := Link with the dictionary Dict_2;
//Parameter that needs to be controlled
ParamsControl := Link.ParamsControl;
Param := ParamsControl.ReferenceDictionary.Params.Item(0);
ParamsControl.Expression(Param).AsString := "10";
MObj.Save;
End Sub Macro;
After executing the example, the attribute used to link with the Dict_2 dictionary is created in the first dictionary. The link between the Dict_1 and Dict_2 dictionaries is established by the Key attribute. A permanent value 10 is set as a parameter value of the linked Dict_2 dictionary.
Executing the example requires the MDM repository with the NSI_1 identifier that contains MDM dictionaries with the Dict_1 and Dict_2 identifiers. The second dictionary has one parameter. Add links to the Dal and Rds system assemblies.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Rds;
...
Public Shared Sub Macro(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict, Dict2: IRdsDictionary;
Attrs: IRdsAttributes;
LinkAttr, ParamAttr: IRdsAttribute;
Link: IRdsLink;
Param: IRdsParam;
ParamsControl: IRdsParamsControl;
Begin
MB := Params.Metabase;
MObj := MB.ItemByIdNamespace["Dict_1", MB.ItemById["NSI_1"].Key].Edit();
Dict := MObj As IRdsDictionary;
Dict2 := MB.ItemByIdNamespace["Dict_2", MB.ItemById["NSI_1"].Key].Bind() As IRdsDictionary;
//Attributes of the first dictionary
Attrs := Dict.Attributes;
//Attribute for linking with the dictionary
LinkAttr := Attrs.Add();
LinkAttr.DataType := DbDataType.ddtInteger;
LinkAttr.Id := "LinkAttr";
LinkAttr.Name := Link attribute;
//Link with the parameterized dictionary
Link := Dict.Links.Add();
Link.Attribute := LinkAttr;
Link.Reference := Dict2.Attributes.Key;
Link.Id := "Link";
Link.Name := Link with the dictionary Dict_2;
//Parameter that needs to be controlled
Param := Link.Reference.Dictionary.Params.Item[0];
//Attribute for linking with the dictionary
ParamAttr := Attrs.Add();
ParamAttr.DataType := Param.Attribute.DataType;
ParamAttr.Id := "ParamAttr";
ParamAttr.Name := Parameter control;
//Linking attribute to the parameter of the second dictionary
ParamsControl := Link.ParamsControl;
ParamsControl.ParamAttribute[Dict2.Params.Item[0]] := ParamAttr;
MObj.Save();
End Sub;
After executing the example, the attribute used to link with the Dict_2 dictionary is created in the first dictionary. The link between the Dict_1 and Dict_2 dictionaries is established by the Key attribute. A permanent value 10 is set as a parameter value of the linked Dict_2 dictionary.
See also: