Skip to main content

 

 

 

Template:OutSystems/Documentation_KB/Breadcrumb_New_Layout

 

 

Template:OutSystems/OSLanguageSwitcher

 

 

 

OutSystems

How to export entity data to Excel

Template:OutSystems/Documentation_KB/ContentCollaboration
  • Edit
    Collaborate with us
    Edit this page on GitHub
  • We've been working on this article. Please let us know how useful this new version is by voting.

    To export the data you must use the Record List To Excel action. This generates an Excel worksheet with the data existing on a selected entity. You then need to enable the user to download the generated Excel file.

    This article shows how it's done in both Reactive Web and Traditional Web.

    In Reactive Web the Record List To Excel action is only available in server actions.
    In Traditional Web, although the action is available in screen actions, it's strongly advised that you use it in server actions only.

    Exporting data to Excel in Reactive Web

    In this example lets start by creating a users list screen, by dragging the Users entity to the main flow. To do it, open your app in Service Studio and do the following:

    1. In the Interface tab, double-click on Main Flow.

    2. On the Data tab, expand the (System) entry of the Database, and drag the User entity to the development main editor:

    3. Double-click the Users screen to open the screen.

    4. Add a link or button to your screen that showing data in a list.

    5. In the On Click event of your link or button, select New Client Action:

      Creating a new client action

    Creating the download logic

    Now that you have done all required actions on the screen is time to create the logic.

    In your client action:

    1. Add a Server Action to your flow:

      Creating a new client action

    2. When the pop-up displays, select New Server Action.

    3. Double-click the Server Action to enter its flow.

      In the server action:

      1. Go to the Data tab a drag the User entity to your flow creating a GetUsers aggregate.

      2. Add a Record List to Excel to you flow, after the aggregate.

      3. In the Record List to Excel properties, select the GetUsers.List:

        Export Entity to Excel

      4. Select the attributes you want to export to Excel, by checking them. These are your Excel columns.

      5. Add an Output parameter to your server action, and change its type to binary data.

        This Output parameter enables your screen action to consume the Excel data exported in the server action:

        Export Entity to Excel

      6. Finally, add an Assign to your flow, and assign the your Output Parameter with the RecordsListToExcel value:

        Export Entity to Excel

      7. Having this done, go back to your Client Action.

    4. Back in the client action, delete the End point of your flow.

    5. Add a Download as the end of your flow:

      Export Entity to Excel

    6. Finally, in the Download details, select the Server Action Output Parameter as the file content.

      In the File Name just type your desired file name within quotation marks. For example, Users.xlsx.

    If it's expected that the user downloads the file several times, you may want to concatenate the name with CurrDateTime().

    Exporting data to Excel in Traditional Web

    1. In this example lets start by creating a users list screen, by dragging the Users entity to the main flow. To do it, open your app in Service Studio and do the following:

      1. In the Interface tab, double-click on Main Flow.

      2. Click on the Data tab, expand the (System) entry of the Database, and drag the User entity to the development main editor:

    2. Double-click on the Users screen to open the screen.

    3. Add a link or button to your screen that showing data in a list. In the link or button details:

      • Set the Method to Submit.
      • Create a New Screen Action in the Destination.

      Export Entity to Excel

    Now that you have created everything on the screen, from this moment on you can follow the same instructions as in Reactive Web to add the necessary logic.