Attribute expressions
In Reporting, you can use the functions attributeAsString, attributeAsNumber and attributeAsDateTime in expressions to report on individual attribute values from the Attributes field of business objects such as Base assets.
Each function has its own supported attribute types, validation behavior and output formatting.
Sample attribute data
The following table contains the sample data that will be used to illustrate the effect of each attribute function when it is applied.
Attribute code | Attribute name | Attribute value | Attribute system type |
|---|
age | Age | 10 | Integer |
brand | Brand | Volvo | Text |
entryDate | Date of entry | 27/03/2025 | Date |
height | Height | 10.6 | Decimal |
serviceDateTime | Service date time | 27/03/2025 08:49 | DateTime |
timeToStart | Time to start | 08:49 | Time |
attributeAsString
The function attributeAsString(<Attributes field>, "<attributeCode>") returns the value of the specified attribute as a text (String) value.
• It supports attributes with system types:
◦ Integer
◦ Decimal
◦ Text
◦ Date
◦ DateTime
◦ Time
• The value is converted to a string and formatted according to the user locale (for dates, times and numbers).
Report result examples
Based on the
Sample attribute data, the following result can be expected:
(Results are shown with default formatting for the user locale.)
Expression | Report result* |
|---|
attributeAsString('Base assets'.Attributes, "age") | 10 |
attributeAsString('Base assets'.Attributes, "brand") | Volvo |
attributeAsString('Base assets'.Attributes, "height") | 10.6 |
attributeAsString('Base assets'.Attributes, "entryDate") | 27-3-2025 |
attributeAsString('Base assets'.Attributes, "serviceDateTime") | 27-3-2025 08:49 |
attributeAsString('Base assets'.Attributes, "timeToStart") | 08:49 |
*Formatting uses the default mask based on the user’s locale.
attributeAsNumber
The function attributeAsNumber(<Attributes field>, "<attributeCode>") returns the value of the specified attribute as a number.
• It supports attributes with system types:
◦ Integer
◦ Decimal
• The value is converted to a numeric value and formatted according to the user locale (for decimal separators and number formatting).
Report result examples
Based on the
Sample attribute data, the following result can be expected:
(Results are shown with default number formatting for the user locale.)
Expression | Report result* |
|---|
attributeAsNumber('Base assets'.Attributes, "age") | 10 |
attributeAsNumber('Base assets'.Attributes, "height") | 10.6 |
*Formatting uses the default numeric mask based on the user’s locale.
attributeAsDateTime
The function attributeAsDateTime(<Attributes field>, "<attributeCode>") returns the value of the specified attribute as a date/time value.
• It supports attributes with system types:
◦ Date
◦ DateTime
◦ Time
• The value is converted to a Date/Time and formatted according to the user locale (date and time masks).
Report result examples
Based on the
Sample attribute data, the following result can be expected:
(Results are shown with default date/time formatting for the user locale.)
Expression | Report result* |
|---|
attributeAsDateTime('Base assets'.Attributes, "entryDate") | 27-3-2025 |
attributeAsDateTime('Base assets'.Attributes, "serviceDateTime") | 27-3-2025 08:49 |
attributeAsDateTime('Base assets'.Attributes, "timeToStart") | 08:49 |
*Formatting uses the default mask based on the user’s locale.