Skip to main content

Attributes

What are attributes?

In Alloy, an attribute is a data field that represents a single characteristic of the concept described by a design/interface.

Attributes can be used to represent almost any kind of data, from physical characteristics (e.g. dimensions, location, condition) to abstract characteristics (e.g. unit number, installed date, owner).

There are several types of attribute for storing different types of data. Some are pretty standard, such as Text, Number and Date attributes. Others are a bit more specialised, such as Geometry attributes that store GeoJSON coordinates. Don't worry, we have a Geometry Editor that lets you draw points, lines and shapes if you don't fancy writing code! 😅

Link attributes are a special type that can store references to items of a particular design/interface (e.g. a Teams item can store links to multiple Team Members items). This lets you represent the relationships between assets, activities and more.

Some example item attributes and values

Define attributes on designs/interfaces

You can add custom attributes to any design or interface, whether it's a system one provided with Alloy or one created by your organisation. Additionally, you can implement one or more interfaces to inherit their attributes.

Each custom attribute has properties, such as Required and Default value. These can be edited at any time. However, note that any existing items will remain unchanged until they're next edited.

For example, setting a Default Value for an attribute won't automatically populate that value on existing items where the attribute is blank. However, the attribute will be pre-populated with that value when those items are next edited.

You can delete a custom attribute from a design or interface, providing that no existing items have a value for it. If there are, you can edit those items to clear those values, or delete the items if they're no longer needed. Use bulk actions to update multiple items at once!

To learn more, see Edit the design or interface.

Note

While system attributes can't be edited or deleted, you can use item forms to customise their behaviour or hide them entirely 🙈.

Example attributes on a custom Litter Bin design

Populate attributes on items

When creating or editing an item of a design, you can populate the item's attributes with data values. Depending on each attribute's type, this may involve selecting values with a specialised picker, or typing a value directly into the field.

By default, all attributes are displayed in the order they were added. If an attribute is configured with a Default Value, it will be populated automatically but can typically be changed before saving.

Attributes marked with an asterisk * have their Required property enabled, so they must contain a value when the item is saved. They can't be left blank!

Note

It's possible to encounter items with empty required attributes, which were saved before those attributes were made required. They will require a value when the item is next edited.

Example attributes populated on an item of a custom Litter Bin design

Attribute types

Select an attribute type to learn about its properties.

IconTypeDescriptionInput Method
AQSStore an AQS query in JSON formatBuild a query in the AQS Builder
DateStore a date value, e.g. 30 April 2024Select a value with the calendar picker
Date TimeStore a date and time value, e.g. 2 July 2025 13:30:00Select a value with the calendar picker
GeometryStore geometry coordinates in GeoJSON formatDraw points, lines or polygons using the Geometry Editor
JSONStore JSON codeType into a fullscreen JSON Editor
LinkStore the ID of one or more items of a specific design/interfaceSelect one or more items with the item picker
NumberStore a number value, e.g. 256, 3.1415Type directly into the field
SeasonalStore a date without a year, e.g. 25th DecemberSelect a value with the calendar picker
TextStore a text value, e.g. My friends and I love Alloy and use it every dayType directly into the field
TimeStore a time value e.g. 14:20:55Select a value with the calendar picker
Yes/NoStore a boolean value, e.g. true or falseToggle the field to enable/disable it