Attribute names are case-sensitive. Unlike previous versions, User [sic] attributes can be renamed after creation: System attributes can not be renamed. A rename might be to use a completely different term, e.g. $Cost renamed to $Price, or it might be a change of case, $cost to $Cost.
Simply select the attribute in the Document Inspector's User tab, select the name, enter a new value and press Return. Attribute listings and Key Attribute entries will update. However, any explicit references to the old name in action or export code, templates, boilerplate code, etc., will be unaffected. Such references must be manually edited to reflect the change but don't overlook agents as a help to find such references for correction.
Renaming & existing values
Do not assume renaming an attribute will retain the values used under the old name. Although values may persist in some cases, do not rename attribute based on that premise. If the attribute you wish to rename already has values in some notes, do not rename but rather make a new attribute, transfer the values and then delete the old attribute. For example, an existing Number-type user attribute $Price needs to be renamed to $TotalPrice but $Price already has values. The process advised is as follows (it only looks long as it is given in a lot of detail - it is actually very quick to do:
- Work on a copy of the data - make a copy of the TBX before starting this process
- Make a new Number-type user attribute 'TotalPrice'
- Disable any rules/agents that might be alter values of $Price while making this attribute change.
- Create an agent with the query
hasLocalValue("Price"). This will match all notes that have a (local, not inherited) value set for the existing Price attribute. If you have a prototype that sets a value inherited b other notes, only the prototype will match as well as notes that have a value set deliberately in that note.
- Check the agent matches to sort of notes expected - good to do before diving straight in to copying any values. If all looks good…
- Set an agent action
$TotalPrice = $Price. For each matched note—and only matched notes—the value of the $TotalPrice attribute is set to the notes existing $Price value.
- At this point both attributes in matching notes have a value, and the same one. This is another opportunity to check things look good if trying this for the first time (Outline column view can help). Assuming all looks good…
- Delete the agent. Do not forget this step!
- Open the Document Inspector's User tab, and select the 'Price' attribute. Using the gear-wheel button (at right) from the pop-up choose the 'Delete user attribute' option. The 'Price' attribute is deleted along with any data.
- Other tidy-up issues:
- KeyAttributes. If $Price was used as a key attribute you will need to use an agent to find and remove the old name and add the new one.
- Action code. Review code in Stamps and any Action-type attributes (e.g. $Rule, $AgentAction, etc.) to find and remove the old name and add the new one.