FREE OutSystems Workshops - Build an OutSystems App in 1 hour | ENROLL NOW

Why should I use a Structure as Source of an Aggregate if it doesn’t have any data?

< Back to Blog

I have been working with OutSystems for over a year, but I have trained new developers in the last 10. I can assure you I have never worked with a software development tool as powerful and as easy to learn as Outsystems… but…

But sometimes things get confusing, and that is where things get interesting :)

I think I know very well OutSystems training materials, I use them almost every day, and some slides I even know them by heart.

A few weeks ago, one trainee came to me and asked, “Why should I use structures in an aggregate if they don’t have any data inside?”

My answer was something like: “Can you?”

But in reality, you can also mark a Structure as a Source:

However, if the structure (1) doesn’t have any data, and (2) the columns don’t even appear in the preview, the question is: Why?

  1. Because it isn’t a source like others.
  2. Because it has no data to show in aggregate.

Yet, it can store temporary data in those attributes left by the structure, extra attributes that can be used in the User Interface.

Structures are handled as Sources in an Aggregate because they are useful for the Aggregate to generate the SQL query. The SQL query result will include some extra null columns, like in the example below:




Using debug tools, you can see that at runtime, the aggregate now has 4 new “columns” containing default values.

Furthermore, those new fields can store data about particular rows in the list.

In the image above, you can see the usage of that boolean value to manipulate the color in an If widget. At this example, the two If widgets have the conditions: “EventTable.List.Current.CRUD.HasUpdated”, and, “EventTable.List.Current.CRUD.HasDeleted”, respectively.

To manipulate these values, you can use Check Boxes with the variable property set to "EventTable.List.Current.CRUD.HasUpdated” and “EventTable.List.Current.CRUD.HasDeleted”.

In the image below, you can see that if you select one Check Box, the value of that particular item on the list will change:

We must realize something… the items saved on that CRUD structure are just data saved on the widget list and are not persisted in the database. If you want to save or use that data in the future, you need to save it somewhere and remember that you don’t have an entity in the database for that. As soon as you refresh the screen, you will lose all that information.

Remember, learning OutSystems can be very rewarding. But it helps if you fall in love with the platform! The second you and OutSystems meet each other very intimately, you will understand its behavior.

Say hello to the future!

Turn Up Academy

Apply to our Turn Up Boot Camp


Latest Articles

Tech Bites - Set timers to delete records

Set timers to delete records

In this tech bite, we will demonstrate how to set timers to delete records and use an online store as an example.

Tech Bites
Tech Bites - How to import data from an excel file

How to import data from an excel file

In this video, we’ll show you how to upload and store data from an excel file.

Tech Bites
Tech Bites - How to run aggregates for each table row

How to run aggregates for each table row

In some situations, we need to show specific data in a table row or a list item that might not be directly related to the data we are using on the aggregate.

Tech Bites