Calculated: Boolean;
Calculated: boolean;
The Calculated property determines whether the attribute is a calculated one.
Available values:
True. The attribute is a calculated one (available only for table MDM dictionary). 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 repository contains an MDM repository with the RDS identifier, that contains a table MDM dictionary with the DICT identifier.
Add links to the Metabase, Rds, 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.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Rds;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RdsKey: uinteger;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
Attrs: IRdsAttributes;
Attr: IRdsAttribute;
Begin
MB := Params.Metabase;
RdsKey := MB.GetObjectKeyById("RDS");
MObj := MB.ItemByIdNamespace["DICT", RdsKey].Edit();
Dict := MObj As IRdsDictionary;
Attrs := Dict.Attributes;
Attr := Attrs.Add();
Attr.DataType := DbDataType.ddtInteger;
Attr.Id := "CALC_ATTR";
Attr.Name := "Calculated attribute";
Attr.Calculated := True;
Attr.Query := "#TABLE#.KEY + 1";
MObj.Save();
End Sub;
See also: