The Output Structure folder contains the Entities and/or Structures that define the structure (data types of the columns) of the result of executing the SQL query. Since the OutSystems Platform has a strongly typed language, the output definition must match the query result or you'll get an error.

The Output Structure is mandatory: even if your SQL statement does not return any results, you need to specify some output structure. To specify the Output Structure of an SQL query, simply right-click the Output Strucure folder in the query editor and select the Entities and Structures from the options available.

If you need to design a query and its output does not match any Entity or Structure already defined, simply create a new Structure that maps to the query result.

Output Structures Order

The order by which the Entities and/or Structures appear in the Output Structure folder is relevant and you must match the order of the attributes in the query.

For example, if the Entity User contains the Attributes Id, Name, Email, PhoneNumber, but your SQL statement only fetched Email and Name (Select Email, Name), then you need to create a new Structure that has the attributes Email and Name (in this order).

See Also

About SQL