A Record is a data type composed by a fixed number of attributes, each one with its own data type.
Use a Record to define a compound data type that is used for a single variable. If you need to define more than one variable with the same compound data type, use a Structure instead.
Some use cases for using the Record data type are when:
You need a user action that returns compound information, but don't want to define a new Structure.
We have an Aggregate that returns information about a contact and whether the contact's birthday is today. As such, the Aggregate output type is a List of Records (Contact + Boolean).
Since we want to return the information for a specific contact, our User Action needs to have an output parameter with Record (Contact + Boolean) data type. So the output parameter of our User Action needs to be defined as a Record (Contact + Boolean).
There are two ways to define the data type of the output parameter. The easiest is to accept the suggestion OutSystems Platform presents, to create the same data type has the Aggregate return type.
You can also click on '(Data Type Editor...)' to customize the data type of your output parameter.
When working with data, you often need to convert your records into another data type.
OutSystems Platform allows you to convert a record of a data type into another type. You can only do this conversion when setting the value of input parameters of web blocks and actions.
For each attribute in the destination data type you define which value to use. OutSystems Platform automatically maps attributes with matching names that have the same data type.
You need to display a pie chart that shows the distribution of contacts by country. You retrieve the necessary information using an Aggregate, that has an output format of a 'CountryName, Count' List.
Now you need to set the output of this aggregate as the input of the pie chart widget. However, the pie chart widget expects a DataPoint list, so you need to convert the Aggregate output into a DataPoint list.
To do this, set the pie chart's 'SourceDataPointList' input parameter with GetCountByCountries.List value. OutSystems Platform notices that a data type conversion is needed, so it allows you to map the attributes in the Conversion section of the Properties pane:
Overview of System Actions and Functions | Available Data Types