IRdsParamsControl.ParamAttribute

Syntax

ParamAttribute(Param: IRdsParam): IRdsAttribute;

Parameters

Param. Parameter of a linked dictionary, for which it is necessary to determine binding.

Description

The ParamAttribute property determines binding of a parameter of a linked dictionary with an attribute of a current dictionary, control is executed through its values.

Example

Executing the example requires an MDM repository with the NSI identifier that contains table MDM dictionaries with the DICT_1 and DICT_2 identifiers. Add an attribute and a parameter to the second dictionary, by which a binding is created.

Add links to the Metabase, Dal and Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict1, Dict2: IRdsDictionary;
    Attrs: IRdsAttributes;
    LinkAttr, ParamAttr: IRdsAttribute;
    Link: IRdsLink;
    Param: IRdsParam;
    ParamsControl: IRdsParamsControl;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace(
"DICT_1", MB.ItemById("NSI").Key).Edit;
    Dict1 := MObj 
As IRdsDictionary;
    Dict2 := MB.ItemByIdNamespace(
"DICT_2", MB.ItemById("NSI").Key).Bind As IRdsDictionary;
    
// Get first dictionary attributes
    Attrs := Dict1.Attributes;
    
// Add an attribute for linking with the second dictionary
    LinkAttr := Attrs.Add;
    LinkAttr.DataType := DbDataType.Integer;
    LinkAttr.Id := 
"LINKATTR";
    LinkAttr.Name := 
Link attribute;
    LinkAttr.HasMultipleValues := 
True;
    
// Add a link between dictionaries
    Link := Dict1.Links.Add;
    Link.Attribute := LinkAttr;
    Link.Reference := Dict2.Attributes.Key;
    Link.Id := 
"LINK";
    Link.Name := 
Link with the DICT_2 dictionary;
    Param := Link.Reference.Dictionary.Params.Item(
0);
    
// Add an attribute for controlling values of the second dictionary parameter
    ParamAttr := Attrs.Add;
    ParamAttr.DataType := Param.Attribute.DataType;
    ParamAttr.Id := 
"PARAMATTR";
    ParamAttr.Name := 
Parameter control;
    ParamAttr.HasMultipleValues := 
True;    
    
// Bind attribute to values of the second dictionary parameter
    ParamsControl := Link.ParamsControl;
    ParamsControl.ParamAttribute(Dict2.Params.Item(
0)) := ParamAttr;
    ParamsControl.ValueSelect(Param) := RdsParamsControlValueSelect.Default_;
    MObj.Save;
End Sub UserProc;

After executing the example two attributes are added in the first dictionary: the first one is used to link with the DICT_2 dictionary; the second one, to control parameter values of the DICT_2 dictionary. Both attributes may contain multiple values selection. A link with the second dictionary is set up in the first dictionary by the LINKATTR link attribute. A binding of the PARAMATTR attribute, by which the array of all attribute values is to be sent, is created for the parameter of the second dictionary.

When creating an element, the first dictionary displays fields for setting attribute values. The list of LINKATTR attribute values depends on the value of the PARAMATTR attribute that is connected with the parameter of the second dictionary.

See also:

IRdsParamsControl