This allows the user to view the current document's user-defined (i.e. custom) attributes. This Inspector allows the user to view and change their data type and default values.
Attribute. This pop-up menu lists all User attributes already defined (otherwise the list is empty). Selecting a list item loads it into the Name box below the pop-up. The list is sorted case insensitively (i.e. A–Z, before a–z, before 0–9).
Gear wheel button (right):
- Delete user attribute. Press this option to delete the attribute currently shown in the Name box. See more detail below.
- New user attribute. Press this option to add a new user attribute. See more detail below.
Name. Shows the name of the selected Attribute. Also used for setting the name of a new attribute. This input rejects attempts to create an attribute name that contains operators like + or punctuation like ";".
Type. The data type for the selected attribute. Open the pop-up to change the data type. The change is saved as soon as this control loses focus. The selected value (as a zero-based number) is recorded the document's XML attribute type definition for this attribute.
Default. This box shows the program's default for the attribute's selected Type (more on data types). The value may be left as the default or set to a desired initial value.
Suggested. Enter an optional list (semi-colon delimited) of suggested attribute values.
sequential (tick-box). An option only for Number-type attributes. When ticked all notes, including existing notes are allocated a sequential number. Unused numbers, e.g. from deleted notes, are not re-used making the number also a unique identifier. Notes duplicated or copied/pasted are allocated a new number. Aliases use the original's value.
Displayed attribute for selected notes. Ticking this box will add the attribute as a Displayed Attribute to all currently selected items (adding to existing Displayed Attributes if found). In general this is a less useful way of adding Displayed Attributes than using the control at the top of the text pane. As changing the value here changes the note's $DisplayedAttributes, it is not the best method to set/manage Displayed Attributes if using prototypes as the edit may break inheritance of the attribute (more on Displayed Attributes). If some selected items do not use this Displayed Attribute and some do, the box remains un-ticked. Ticking it sets this for the whole selection.
Lines (shown for String/Set/List/Dictionary types only). A slider control allows a variable number of lines to be used to display String-type attribute values in the display tables of Displayed Attributes and Get Info/attributes. The default value is 1. The slider has seven stop positions running from left (1) to right (7).
Description. This holds an optional user's description of the intent and/or usage of the attribute. The description is only seen in the inspector when the attribute is actually selected. The value is stored in the TBX but cannot be accessed except via this Inspector.
Creating a New User Attribute
On selecting the option to make a new attribute, the Attribute pop-up will change to show 'NewAttribute'. The Name box is not refreshed; any previously shown attribute name is retained deliberately, in case it is to be used as part of the new attribute. Edit or delete the existing text to add the desired new value. The new attribute is created as soon as focus shifts away from the Name box. The default data type is 'string' and the default value is no value, i.e. an empty string. Optionally, a description of the attribute, e.g. its purpose, may be added. The latter description is only seen in this Inspector and when this attribute is selected.
When a new attribute is created, the default value of that attribute is set to a conventional value. For example, the default value for a new numerical attribute is 0, and the default value for a new Boolean attribute is false
.
When a 'new attribute' is selected in a document where user attributes already exist, the existing selected attribute name is retained but all other value input boxes are reset to default.
Altering an existing attribute
Note: there is no undo for this operation.
Select the attribute from the Attribute list. Name, Type, Default, Description and tick-box settings can all be changed. The changes take effect once focus moves off the edited input box. When a user attribute is renamed, the values of the old attribute are moved to the new attribute, and Displayed Attributes referring to the new attribute are updated to use the new attribute. But, before changing data type, do consider the effects: it may make more sense to make a new attribute of the desired type and use an agent to copy values across with whatever additional changes are needed over and above basic type coercion. Changes to the attribute name will update Displayed Attributes but do not update attribute names in action code (e.g. roles, edicts, etc.). If using action code in a TBX, consider this aspect before altering an existing attribute.
When the type of an existing attribute is changed, the default value of that attribute is reset to a conventional value. For example, the default value for a new numerical attribute is 0, and the default value for a new Boolean attribute is false
. When a 'new attribute' is selected, the existing selected attribute name is retained but all other value input boxes are reset to default.
Deleting a User Attribute
Select the attribute to be deleted sing the Attribute list. Once selected, choose the Delete user attribute option. The selected item is deleted immediately. Note: there is no undo for this operation.
See also—notes linking to here:
- Turning off Google tracking
- Determining the data type of an attribute
- attrib - attribute
- Setting up for Tab-Delimited Import
- Renaming an attribute
- Attribute Naming
- OmniOutliner
- Document attribute defaults
- Attributes vs. variables in functions
- Displayed Attributes table
- Suggest Attribute value lists
- attributes tab
- createAttribute(nameStr[, dataType])
- Comment code and attribute descriptions
- Pre-populating Displayed Attributes pop-up lists
- Attributes
- Setting or resetting an attribute's document-level default value