Pagination Works From Record Source but Not Record Listing

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 @

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I do not see any obvious problems. Can you share more of your code? Especially I am interested in that local!integrationResponse. Starting with the integration object itself, you need to validate each and every step, making sure that the correct values go in and come out.

    Two tips:

    - You can cast a list of items without a foreach. Just cast to a!listType(<YOUR_RECORD_TYPE>).

    - You can extract all values form a list of items without a foreach -> "local!integrationResponse.result.body.items.id"

  • I think I eliminated caching as the possible problem because when I set the number of records for the record listing to 1000, it lists all of those records.

  • 0
    Certified Lead Developer
    in reply to Ryan Daniels

    Caching might only become an issue when the parameters do not change.

    Does that local integrationResponse contain the expected data when paging?

  • Yes. Both the integration and the record data source properly page the data when testing individually.

  • 0
    Certified Lead Developer
    in reply to Ryan Daniels

    Do you use it in a grid to display the data? Can you share that code?

  • Like the definition of the columns?

    {
      a!gridColumn(
        label: "Col1",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col1}col1',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col1}col1']
      ),
      a!gridColumn(
        label: "Col2",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col2}col2',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col2}col2']
      ),
      a!gridColumn(
        label: "Col3",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col3}col3',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col3}col3']
      ),
      a!gridColumn(
        label: "Col4",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col4}col4',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col4}col4']
      ),
      a!gridColumn(
        label: "Col5",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col5}col5',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col5}col5']
      ),
      a!gridColumn(
        label: "Col6",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col6}col6',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col6}col6']
      ),
      a!gridColumn(
        label: "Col7",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col7}col7',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col7}col7']
      ),
      a!gridColumn(
        label: "Col8",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col8}col8',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col8}col8']
      ),
      a!gridColumn(
        label: "Col9",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col9}col9',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col9}col9']
      ),
      a!gridColumn(
        label: "Col10",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col10}col10',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col10}col10']
      ),
      a!gridColumn(
        label: "Col11",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col11}col11',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col11}col11']
      )
    }
    

Reply
  • Like the definition of the columns?

    {
      a!gridColumn(
        label: "Col1",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col1}col1',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col1}col1']
      ),
      a!gridColumn(
        label: "Col2",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col2}col2',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col2}col2']
      ),
      a!gridColumn(
        label: "Col3",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col3}col3',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col3}col3']
      ),
      a!gridColumn(
        label: "Col4",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col4}col4',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col4}col4']
      ),
      a!gridColumn(
        label: "Col5",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col5}col5',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col5}col5']
      ),
      a!gridColumn(
        label: "Col6",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col6}col6',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col6}col6']
      ),
      a!gridColumn(
        label: "Col7",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col7}col7',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col7}col7']
      ),
      a!gridColumn(
        label: "Col8",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col8}col8',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col8}col8']
      ),
      a!gridColumn(
        label: "Col9",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col9}col9',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col9}col9']
      ),
      a!gridColumn(
        label: "Col10",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col10}col10',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col10}col10']
      ),
      a!gridColumn(
        label: "Col11",
        sortField: 'recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col11}col11',
        value: fv!row['recordType!{4d44effc-c462-4c70-b1aa-87905a73c395}YYY_MyRecord.fields.{col11}col11']
      )
    }
    

Children