Query regarding pagination in Interface

Certified Senior Developer

Hi, 

I have a large number of records in database and I'm fetching that using queryEntity() function and showing it in a gridField(). I have given pagingInfo() detail in queryEntity() like 

a!pagingInfo( startIndex: 1, batchSize: - 1)  and in gridField() like  a!pagingInfo( startIndex: 1, batchSize: 50). Now I want know that does Appian fetch all the records from database in one go or not? If so, I want to  search records in the batch size of 50, so that, when I click next button in the pagign the next 50 records will be fetched from database. How could I do that?

  Discussion posts and replies are publicly visible

Parents
  • Hi  ,

    In addition to Abhay Giri's points, I would like to share a piece of code which may help you.

    load(
    local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 10 /*Change it as per your requirement*/
    ),
    local!var1: rule!YourQueryEntityRule(
    pagingInfo: local!pagingInfo
    ),
    with(
    local!var2: local!var1.data,
    a!gridField(
    columns: a!gridTextColumn(
    label: "Id",
    field: "fieldName",
    data: local!var2.fieldName
    ),
    value: local!pagingInfo,
    totalCount: local!var1.totalCount,
    saveInto: {
    local!pagingInfo,
    a!save(
    local!var1,
    rule!YourQueryEntityRule(
    pagingInfo: local!pagingInfo
    )
    )
    }
    )
    )
    )

Reply
  • Hi  ,

    In addition to Abhay Giri's points, I would like to share a piece of code which may help you.

    load(
    local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 10 /*Change it as per your requirement*/
    ),
    local!var1: rule!YourQueryEntityRule(
    pagingInfo: local!pagingInfo
    ),
    with(
    local!var2: local!var1.data,
    a!gridField(
    columns: a!gridTextColumn(
    label: "Id",
    field: "fieldName",
    data: local!var2.fieldName
    ),
    value: local!pagingInfo,
    totalCount: local!var1.totalCount,
    saveInto: {
    local!pagingInfo,
    a!save(
    local!var1,
    rule!YourQueryEntityRule(
    pagingInfo: local!pagingInfo
    )
    )
    }
    )
    )
    )

Children