I have a non-synced REST API that I am using to fetch data via an integration. This endpoint supports paging. In both the record data source and the integration, when I put a a!pagingInfo(x, y), in the pagingInfo test inputs, the data increments through pages correctly according to the values I give for x and y.
But, in the data model test listing and the record list URL, the first 50 records appear (as expected) with the correct record total (more than 1,000), but when I click the next button, the next page is blank and says "No items available". I can click the previous button, and the first 50 records display again. The Paging Info drop down on the data model page is mapped to the correct rule input on the record data source.
The Appian version is 23.2.
Here is my code for the dataSubset in the record data source:
a!dataSubset( startIndex: ri!pagingInfo.startIndex, batchSize: ri!pagingInfo.batchSize, totalCount: local!integrationResponse.result.body.total_items, data: a!forEach( local!integrationResponse.result.body.items, cast( 'type!{urn:com:appian:types:YYY}YYY_MyRecordType', fv!item ) ), identifiers: a!forEach( local!integrationResponse.result.body.items, fv!item.id ) ),
I cannot seem to find anything wrong. What am I missing?
UPDATE:
The problem was that I needed to convert start index into a page number.Much appreciation for the tremendous effort to help from @Stefan Helzle
Discussion posts and replies are publicly visible
Problem solved. After finding someone who has access to the logs, I quickly found the problem. The paging info has a start index giving the 1-based offset in the total number of records, while the endpoint has an offset that is actually a page number, so I needed to convert start index to a page number based on the batch size.
I am glad you got this resolved. I have been in similar situations before and validating each and every step in that chain is the route to success.
Hi Stefan Helzle Ryan Daniels , I'm facing a similar issue, In my case, the pagination itself is not visible. The total number of records are 110. If I set Rows to Display Per Page as 100, it is returning all 100 rows of data but pagination is not workingCould you please help me on this. Please find the below screenshots:1. 2. 3.
Can you check the total count:
a!queryRecordType( recordType: XXXXX, fields: {}, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 100 ), fetchTotalCount: true() ).totalCount
Yogi Patel I guess there is no issues in totalCount. The length() is returning the exact total count. However, I tried using queryRecordType as you suggested, I'm now facing below issue
In totalCount parameter of a!dataSubset, you have to give the total number of records (ex. 550), not the records counts returned in current pages (ex.100).
Ex.
Thank you Yogi Patel