Skip to main content

Developing an Application

 

OutSystems

Create a Table to Persist Data


In OutSystems, a database table is an Entity.pngEntity, and the table columns are Entity Attributes

To create an Entity you need to:

  1. Open the entity diagram created by default in your application;
  2. Right-click the canvas and select 'Add Entity to Database';
  3. In the dialog that pops up:
    • Give a name to the entity;
    • Add attributes to the entity.

Note that in mobile applications, you can create entities to be stored in the local storage. This typically happens when end-users need to take the data offline.

Example

We have an application called Go Out, that allows you to read and write reviews of places you go to, for instance restaurants. Let's see how to create the table that stores the information about these places. 

  1. In the Data tab, under Entity Diagrams, open the GoOutDataModel diagram;
  2. Right-click and choose 'Add Entity to Database';
  3. Set the name of the entity to Place. OutSystems creates an Id attribute with data type Long Integer, set as AutoNumber;
  4. Use the 'EntityAttribute.pngNew' button to create the attributes:

    • Create the Name attribute. By default the data type is set to Text and the length is 50, change it to 100;
      Make the attribute mandatory by setting the Is Mandatory property to Yes;
    • Create the Address attribute as a mandatory Text attribute with 200 characters of length;
    • Create the PhoneNumber attribute. The data type of the attribute changes to Phone Number. Leave this attribute optional;
    • Create the Latitude and Longitude attributes as optional Decimal attributes. Use the default length (37) and decimals (8) to define the precision of the numbers stored in the database.
  5. Publish your application.

When you publish your application, OutSystems creates the database table that corresponds to the Place entity.

  • Was this article helpful?