Calculated: Boolean;
The Calculated property determines whether the attribute is a calculated one.
Available values:
True. The attribute is a calculated one. This value is not available if:
The attribute is a system one, that is, IRdsAttribute.Predefined = True.
If the attribute can contain multiple values, that is, IRdsAttribute.HasMultipleValues = True.
Text of the query used to calculate attribute value, is defined in the IRdsAttribute.Query property. You cannot set value of a calculated attribute. If the query contains main table fields and borrowed fields, the #TABLE# mask should be used before the main fields.
False. The attribute is not a calculated one.
If the dictionary includes calculated attributes, it is reloaded on adding or editing an element.
Executing the example requires that the repository contains an MDM repository with the RDS identifier that includes an MDM dictionary with the DICT identifier.
Add links to the Metabase, Rds, and Dal system assemblies.
Sub UserProc;
Var
MB: IMetabase;
RdsKey: Integer;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
Attrs: IRdsAttributes;
Attr: IRdsAttribute;
Begin
MB := MetabaseClass.Active;
RdsKey := MB.GetObjectKeyById("RDS");
MObj := MB.ItemByIdNamespace("DICT", RdsKey).Edit;
Dict := MObj As IRdsDictionary;
Attrs := Dict.Attributes;
Attr := Attrs.Add;
Attr.DataType := DbDataType.Integer;
Attr.Id := "CALC_ATTR";
Attr.Name := "Calculated attribute";
Attr.Calculated := True;
Attr.Query := "#TABLE#.KEY + 1";
MObj.Save;
End Sub UserProc;
After executing the example a calculated attribute with the CALC_ATTR identifier is added to the MDM dictionary. Attribute value is based on the following formula:element key value + 1.
See also: