IRdsParamsControl.Expression

Syntax

Expression(Param: IRdsParam): IExpression;

Expression[Param: Prognoz.Platform.Interop.Rds.IRdsParam]: Prognoz.Platform.Interop.ForeSystem.IExpression;

Parameters

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

Description

The Expression property returns an expression that determines a permanent value of a parameter of a linked dictionary.

Example

Executing the example requires an MDM repository with the NSI_1 identifier that contains MDM dictionaries with the DICT_1 and DICT_2 identifiers. For the second dictionary, the additional attribute is added and parameter in which properties the created attribute is specified is added too.

Add links to the Dal, Metabase, Rds and ForeSystem (for Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict, Dict2: IRdsDictionary;
    Attrs: IRdsAttributes;
    LinkAttr: IRdsAttribute;
    Link: IRdsLink;
    Param: IRdsParam;
    ParamsControl: IRdsParamsControl;
    Exp: IExpression;
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;
    
// Get first dictionary attributes
    Attrs := Dict.Attributes;
    
// Add an attribute to link the first dictionary with the second
    LinkAttr := Attrs.Add;
    LinkAttr.DataType := DbDataType.Integer;
    LinkAttr.Id := 
"LinkAttr";
    LinkAttr.Name := 
Link attribute;
    
// Link with 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;
    
// Get the second dictionary parameter to be managed from link
    ParamsControl := Link.ParamsControl;
    Param := ParamsControl.ReferenceDictionary.Params.Item(
0);
    
// Set managed parameter to 10
    Exp := ParamsControl.Expression(Param);
    Exp.AsString := 
"10";
    ParamsControl.Expression(Param) := Exp;
    MObj.Save;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Rds;


Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict, Dict2: IRdsDictionary;
    Attrs: IRdsAttributes;
    LinkAttr: IRdsAttribute;
    Link: IRdsLink;
    Param: IRdsParam;
    ParamsControl: IRdsParamsControl;
    Exp: IExpression;
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;
    
// Get first dictionary attributes
    Attrs := Dict.Attributes;
    
// Add an attribute to link the first dictionary with the second
    LinkAttr := Attrs.Add();
    LinkAttr.DataType := DbDataType.ddtInteger;
    LinkAttr.Id := 
"LinkAttr";
    LinkAttr.Name := 
Link attribute;
    
// Link with 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;
    
// Get the second dictionary parameter to be managed from link
    ParamsControl := Link.ParamsControl;
    Param := ParamsControl.ReferenceDictionary.Params.Item[
0];
    
// Set managed parameter to 10
    Exp := ParamsControl.Expression[Param];
    Exp.AsString := 
"10";
    ParamsControl.Expression[Param] := Exp;
    MObj.Save();
End Sub Main;

After executing the example, in the first dictionary the attribute with the LINKATTR identifier will be created that is used to link with the second dictionary.The link by the KEY attribute will be set between dictionaries. A permanent value 10 is set as a parameter value of the linked dictionary with the DICT_2 identifier.

See also:

IRdsParamsControl