24
Views
4
Comments
Solved
control the number of table records displayed per page in a List (not an Aggregate)

Hi 

I’m merging two lists from separate aggregates to create a final list. I’m showing the results in a table, and I’d like to set how many records are displayed per page. How can I do that? 


thank u

2025-12-03 17-22-41
Lavanya Kamalaguru
Solution

Hi @Sultan Alnaabi ,

Inside the data action, I fetch data from both aggregates and use a for each loop for final list. While adding items to the final list, I control the number of records by using Start and Max Records logic, so the required records for the current page are added.

This way, the table displays only the configured number of records per page even though the data comes from multiple aggregates.

I have implemented in the same way. Please check the OML below.


Pagination.oml
UserImage.jpg
Sultan Alnaabi

yes it works 

Thank u 

2025-02-20 04-52-48
Ajay P

Hi @Sultan Alnaabi

Hope you are doing well.

If the structure of the two lists is the same, you can use Advanced SQL to query them together as shown below:

SELECT *FROM (SELECT {Entity1}.*FROM {Entity1}

UNION ALLSELECT {Entity2}.*FROM {Entity2}

) AS combined_EntityORDER BY IdOFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY;

With this, you can control the number of records shown per page. 

Thanks in advance.



2025-12-03 17-22-41
Lavanya Kamalaguru
Solution

Hi @Sultan Alnaabi ,

Inside the data action, I fetch data from both aggregates and use a for each loop for final list. While adding items to the final list, I control the number of records by using Start and Max Records logic, so the required records for the current page are added.

This way, the table displays only the configured number of records per page even though the data comes from multiple aggregates.

I have implemented in the same way. Please check the OML below.


Pagination.oml
UserImage.jpg
Sultan Alnaabi

yes it works 

Thank u 

2018-12-10 12-16-21
Goncalo Duarte Almeida

Hello @Sultan Alnaabi 

Since you aren't binding a single Aggregate directly to your table, you lose that "automatic" pagination magic, but it’s very straightforward to set up manually. 

To control the table, you need two local variables (Integer) to track the state: 

  • StartIndex: The index of the first record to show (default: 0).

  • MaxRecords: How many rows you want per page (e.g., 10 or 20).

In your Screen, select the Table widget and look at the Properties pane. You need to map your manual variables to the widget's built-in pagination properties:

  • Source: Set this to your final merged list.

  • Start Index: Bind this to your StartIndex local variable.

  • Line Count: Bind this to your MaxRecords local variable.

OutSystems provides a Pagination UI Pattern (found in the OutSystemsUI module).

  1. Drag the Pagination block below your table.

  2. StartIndex: Bind it to your StartIndex variable.

  3. MaxRecords: Bind it to your MaxRecords variable.

  4. TotalCount: Bind this to YourMergedList.Length.

  5. OnPaginationClick (Event): Create a new Screen Action for this handler.

When a user clicks "Next" or a specific page number, the Pagination block sends a NewStartIndex value. Your Screen Action should look like this:

  1. Assign: Set StartIndex = NewStartIndex.

  2. Refresh: If your list is merged in the OnAfterFetch of your aggregates, you might not even need a refresh; the Table widget will automatically react to the change in StartIndex and show the correct slice of your list.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.