2187
Views
6
Comments
Solved
Reactive Web Application : Paginate a table with an AdvancedSQL Source.
Question

Hi OutSys Devs out here,

I just wanted to know how to paginate your table when your data source is a AdvancedSQL in Reactive Web App. 

2019-05-22 11-30-09
Marcelo Ferreira
Solution

Hi Roel,

You need to handle the pagination by yourself like this:

You also need to do another query with count to use that count on Navigation widget. and you need to handle the sort a bit differently.

I added an example on attachment for you to check.

Regards,

Marcelo

TableAndAdvancedSql.oml
UserImage.jpg
Shuet Ling Tai

Hi after I added

ORDER BY @TableSort
OFFSET @StartIndex ROWS
FETCH NEXT @MaxRecords ROWS ONLY;


I am having the below query

2022-06-03 09-46-04
MUHAMMAD SYAZANI BIN MOHD FAUDZI

Hi Marcelo Ferreira,

Can you help me with this issue?

Before this, I tried your solution which is working fine but with the latest update, I think this issue is occurring. 

2024-06-25 11-13-30
Mohamed Shahat

i have the same error, did you find the solution? 

2023-10-19 05-09-59
Mangesh Phanse

I am using same solution for rest api. We can send single output parameter as response so not getting how to pass second out put parameter  total count.

Restapicannothavetwooutout.png
2023-10-19 05-09-59
Mangesh Phanse

https://www.outsystems.com/forums/discussion/56822/reactive-web-application-paginate-a-table-with-an-advancedsql-source/#Post214417

Hi Marcelo ,

I modified your resolution with introduction of Structure. This helped me to use in REST API

[Attaching modified OML File. I worked on the oml you shared.]

1 - Introduced structure matching employees named -EmployeeStructure

Another structure Employee Dataset has list of EmployeeStructure and Count variable

2 - In Data action changed the input parameter to EmployeeDataset of type EmployeeDataset

3- Changed the Advanced SQL assignment with EmployeeList and Count with Employee count

Same changed I have implemented in my REST Api action as below. It helped me to implement pagination. 

JSON Returned by REST API action is

{
  "Count": 0,
  "RecordList": [
    {
      "Id": 1234567891234567,
      "EmployeeId": 1234567891234567,
      "RequestId": 1234567891234567,
      "CreatedDate": "2014-12-31",
      "CompletedDate": "2014-12-31",
      "StatusId": 0,
      "BonusAmount": 0.1,
      "BonusThreshold": 0,
      "HalfBonusThreshold": 0,
      "ThresholdUnitPrice": 0.1,
      "HalfThresholUnitprice": "string",
      "RequestName": "string",
      "EmployeeFirstName": "string",
      "EmployeeLastName": "string",
      "StatusLabel": "string"
    }
  ]
}




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