SetAttributeValue(Attribute: Integer; Value: Variant; [Options: RdsDictionaryElementDataOptions = 0]);
SetAttributeValue(
Attribute: uinteger; Value: object;
Options: Prognoz.Platform.Interop.Rds.RdsDictionaryElementDataOptions);
Attribute. Attribute index, which value is necessary to change.
Value. New attribute value.
Options. Parameters of attribute value change.
The SetAttributeValue method changes the value of a specified element attribute.
To change value of parametric attribute the Options parameter must equal RdsDictionaryElementDataOptions.AllowChangeParamAttribute.
Executing the example requires an MDM repository with the RDS_REPO identifier that contains the parametric dictionary with the DICT identifier. This dictionary contains an attribute with the PARAM identifier connected with integer parameter. Add links to the Metabase, Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
RdsKey: Integer;
Dict: IRdsDictionary;
Attrs: IRdsAttributes;
AttrKey, AttrInd: Integer;
ParamsVal: IRdsParamValues;
DictInst: IRdsDictionaryInstance;
Elements: IRdsDictionaryElements;
Element: IRdsDictionaryElement;
Data: IRdsDictionaryElementData;
Begin
mb := MetabaseClass.Active;
RdsKey := mb.ItemById("RDS_REPO").Key;
Dict := mb.ItemByIdNamespace("DICT", RdsKey).Edit As IRdsDictionary;
Attrs := Dict.Attributes;
AttrKey := Attrs.FindById("PARAM").Key;
ParamsVal := Dict.Params.CreateValues;
ParamsVal.FindById("PARAM").Value := 0;
DictInst := Dict.Open(ParamsVal);
Elements := DictInst.Elements;
Element := Elements.Item(1);
Data := Element.Data;
AttrInd := Data.AttributeIndex(AttrKey);
Data.SetAttributeValue(AttrInd, 2, RdsDictionaryElementDataOptions.AllowChangeParamAttribute);
DictInst.Update(Element.Key, Data);
End Sub UserProc;
After executing the example a dictionary is opened with specified parameter values. Then a parameter value is changed for the first element.
Executing the example requires an MDM repository with the RDS_REPO identifier that contains the parametric dictionary with the DICT identifier. This dictionary contains an attribute with the PARAM identifier connected with integer parameter.
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
RdsKey: uinteger;
Dict: IRdsDictionary;
Attrs: IRdsAttributes;
AttrKey: uinteger;
AttrInd: integer;
ParamsVal: IRdsParamValues;
DictInst: IRdsDictionaryInstance;
Elements: IRdsDictionaryElements;
Element: IRdsDictionaryElement;
Data: IRdsDictionaryElementData;
Begin
mb := Params.Metabase;
RdsKey := mb.ItemById["RDS_REPO"].Key;
Dict := mb.ItemByIdNamespace["DICT", RdsKey].Edit() As IRdsDictionary;
Attrs := Dict.Attributes;
AttrKey := Attrs.FindById("PARAM").Key;
ParamsVal := Dict.Params.CreateValues();
ParamsVal.FindById("PARAM").Value := 0;
DictInst := Dict.Open(ParamsVal);
Elements := DictInst.Elements;
Element := Elements.Item[1];
Data := Element.Data;
AttrInd := Data.AttributeIndex[AttrKey];
Data.SetAttributeValue(AttrInd As uinteger, 2, RdsDictionaryElementDataOptions.rdsdiceledatoptAllowChangeParamAttribute);
DictInst.Update(Element.Key, Data);
End Sub;
After executing the example a dictionary is opened with specified parameter values. Then a parameter value is changed for the first element.
See also: