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. 

mvp_badge
MVP
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

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

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.