skip to main content

What is an attribute?

An attribute defines the characteristics and properties that all instances of a class share. The value that an attribute takes on varies between one instance and another of the class on which it is defined, and its value characterizes the instance itself.

Each attribute is characterized by an identifier and a data type.

The identifier must have a unique name within the class and cannot have spaces: the Designer automatically replaces the typing of each space with the _ character.

An attribute

Within the Employee class shown in the figure there is only one attribute: name is the identifier and string is the data type. The warning appears because no Object title has been yet defined.

The data type determines what kind of information is stored through the attribute. The following data types are supported:

  • String: a string of characters;
  • Text: a text;
  • Integer: a numeric data element representing an integer;
  • Real: a numeric data element representing a decimal number;
  • Boolean: a truth value (true or false);
  • Date: a date;
  • Time: a time;
  • Datetime: concatenation of a date and a time;
  • Serial: a progressive number that takes on a unique value for each object in the class;
  • File: reference to a file stored on the server.

Attribute Types #

The following attribute types are supported:

  • native attribute: information stored directly in the object table of a class; it is editable, and it is possible to narrow its domain (the set of values that the attribute can take);
  • derived attribute: attribute whose value is calculated attribute whose value is calculated from the value of other attributes;
  • platform attribute: contains metadata about objects in the class and is automatically managed by Livebase;
  • predefined attribute: attribute defined only on the __User class, managed by the platform.

The Object title #

The Object title is the name by which the object of a class being examined in the application is identified; this name is represented by the value of a single attribute.

Set an attribute as Object title #

Select the attribute and right click to open the Attribute menu; from the drop down menu check the Object title option.

Define an Object title

Create an Object title composed of several attributes #

It is possible to set as Object title a derived attribute of type math that corresponds to the concatenation of several attributes. This concatenation is a string defined in the Math expression editor by means of an expression, which by default is concat(s1," ",s2,...), where s1 and s2 are the names of the attributes involved and " " indicates a space separating them. The name of the object shown in the application is thus calculated by concatenating the values ​​of all the attributes that make up the Object title.

Example: complex Object title

Let’s take for example the Client class shown in the figure; there are three attributes in the list: the first name (first_name), the last name (last_name) and the address (address). If you want to set the full name of the customers as the name of the class object, you can define as Object title a derivative that computes the concatenation of the attributes first_name and last_name (thus not including address).

Hold down the Ctrl key and select at the same time the attributes that should be part of the Object title; click on one of them to open the Attribute menu and select Create object title. Check the expression that is shown in the Math expression editor: if the expression is valid, Expression validated as STRING appears in the panel. By clicking Ok a new attribute, /title, is added to the list. Then you can rename the created Object title as any other attribute.

Define a complex object title

The resulting output expression in the editor will then be concat(first_name," ",last_name).

Expression for an Object title

By default an Object title defined over multiple attributes has the name /title. Once created, you can rename /title to /full_name.

Complex object title