PP.Rds.Attribute(settings: Object);
settings. Attribute settings.
The Attribute desugner creates an instance of MDM dictionary attribute object.
To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Create an attribute, add it to MDM dictionary, and set default attribute value for all children:
// Get MDM dictionary
var source = dictionaryBox.getSource()[0];
// Create an attribute
var attribute = new PP.Rds.Attribute({
Id: "LastEditingDate",
Key: 1805, // Attribute key
ArgKey: 7, // Key of the argument that controls attribute value
HasMultipleValues: true, // Allow to accept several values
IsTranslation: false, // No translation
IsMultilingual: false, // Is not multilingual
Nullable: false, // Cannot accept empty values
Kind: PP.Rds.AttributeKind.Calculated, // Attribute type
Type: PP.Mb.DbDataType.DateTime, // Type
Owner: source, // Dictionary, to which attribute belongs
VisibleForEdit: 2, // Available for edit if not hidden
Visible: true, // Visible attribute
Predefined: PP.Rds.PredefinedAttribute.InDate, // Attribute is predefined
Name: "Last modified", // Attribute name
Tag: "Attributes used to store last modification date", // Custom information
ReadAccess: "1", // Enable the ADMIN user only read permissions
WriteAccess: "2", // Enable the Administrators used write permissions
TimeDependent: true // Display time
});
// Set the created attribute for MDM dictionary
var atrMd = attribute.getSettings();
atrMd.n = attribute.getName();
source.setAttribute(atrMd);
// Add the created attribute to metadata
var metadata = source.getMetadata();
var attrsArr = PP.getProperty(metadata, "attrs.its.it");
attrsArr.push(atrMd);
// Get child dictionary elements
var childEls = source.getChildEls();
// Specify default value for attribute of all elements
for (var i = 0; i < childEls.length; i++) {
childEls[i]._initAttrValues();
childEls[i].setValue("LastEditingDate", attribute.getDefaultValue());
};
// Refresh dictionary element tree
dictionaryBox.getDataArea().getActiveDictTree().refreshAll();
After executing the example an attribute with the key 1805 named Last Editing Date is created and shown in the dictionary. Default attribute value is set for all children:

See also: