Pagination - Memory threshold issue.

We have a query as below
rule!WFT_getRequestDetailsBySearchParams(ri!process,ri!subprocess,ri!action,ri!requestor,ri!company,ri!reference,ri!sapRefNo,if(isnull(ri!fromDate),todatetime(date(2010,10,10)),ri!fromDate),if(isnull(ri!toDate),todatetime((today())),ri!toDate+intervalds(23,59,59)),ri!monetaryValue,ri!priority,ri!wftRequestID,ri!salesOffice,ri!requestStatus,ri!pageInfo)))

In the above query how is "ri!pageInfo" working? I could not find any parameters like batch size set for pageInfo. Please help how does it work for the above query.

How does pageInfo decrease the load on Appian? I have referred the below link, but did not understand much, Please help me on this.
forum.appian.com/.../System_Functions.html

OriginalPostID-254399

  Discussion posts and replies are publicly visible

  • If pageInfo is used the query returns a datasubset, then query returms same number of records that is mentioned in the "batchSize" of pagingInfo, but the totalCount if the datasubset is the total number of records that matches the search criteria.
    For exampple there are 15 records that match the search criteria, if the pagingInfo(startIndex:1, batchSize:10), then the query returns only 10
    records out of 15, but the totalCount of the datasubset will be 15. If the user clicks on the next button in the paging grid, the the startindex gets updated to 11 and gets the query gets the next 5 records. So at a time appian gets 10 records even if the total number of records matching the search criteria are more that the batchsize. Hence the load on appian gets reduced.

    Please let me know if you need more information.
  • Hi sai charan,
    lets take an simple example
    rule!average() has three rule inputs a,b,c of type int. The average funticion gets these inputs from other rule or interface.
    now the average() rule defination goes like

    sum(ri!a,ri!b,ri!c)/3

    I have an interface in that I will call the average rule by passing the inputs like below
    average(a:10,b:20:30)
    now ri!a holds 10 and ri!b holds 20 and ri!c holds 30,with these values, the average() call sum function with out name value pair.
    The same is applicable to your rule
    rule!WFT_getRequestDetailsBySearchParams(ri!process,ri!subprocess,ri!action,ri!requestor,ri!company,ri!reference,ri!sapRefNo,if(isnull(ri!fromDate),todatetime(date(2010,10,10)),ri!fromDate),if(isnull(ri!toDate),todatetime((today())),ri!toDate+intervalds(23,59,59)),ri!monetaryValue,ri!priority,ri!wftRequestID,ri!salesOffice,ri!requestStatus,ri!pageInfo)))

    assume this is a sum() in the above example where you are getting the pagingInfo from some where these rule inputs are defined.

    next to your question.
    How does pageInfo decrease the load on Appian?
    please go through the below sail receipe.
    forum.appian.com/.../recipe_display_array_of_data_in_a_grid.html

    in the above receipe. local!data contains hard coded data which has 6 rows, when the form loaded intially, the parameter of with, i.e. local!dataSubset we get only 3 rows since the batch size is 3 in the local!pagingInfo. When user clicks on next button in the grid, next 3 records will be loaded to local!dataSubset.
    In this way the pagingInfo reduces the load on Appian by dynamically querying the data.
    Please let us know you still need elaborate example.
  • @rameshg73,@chandrasekharg : Thanks for the replies.
    I have implemented pageInfo as below. But the results display only 10 records, If there are total 20 records, only 10 records are displayed. Even after selecting second page, next 10 records are not displayed. Please help us on this.

    =rule!WFT_tempoSearchQueryPagination(pv!process,pv!subprocess,pv!action,pv!requestorName,pv!company,pv!reference,pv!sapRefNo,pv!fromDate,pv!toDate,pv!monetaryValue,pv!priority,pv!wftRequestID,pv!salesOffice,pv!requestStatus,a!pagingInfo(startIndex: 1,batchSize: 10),loggedinuser())
  • if your requirement wants to display all of the Records you can use topaginginfo(1,-1).
  • a!pagingInfo(startIndex:1,batchSize:-1)will return all the records. when Batch Size is -1 it will return all the records
  • @chandrasekharg: I want to display all 20 records, batch size is 10, but query is returning only 10 records .The next 10 records are not fetching.
  • Yes when you specify the batchsize it will only return that many records, You have 20 records and you specified with batchsize as 10 only 10 records displayed. if you have total 9 records when you specify the batchsize as 10 then it will display 9 records only. when you specify the batchsize as -1 it will display all of the records.
  • In this case, how do I fetch only 10 records from the DataBase initially and display. Once first 10 records are displayed I need to fetch next 10 records from DB and display. So as to avoid Memory Threshold Error (Load on Appian).
  • do you have any User Interaction to display the next 10 records, if so you can design a!queryEntity such that it will take a rule input of pagingInfo supply this rule input on each user Interaction. Please let us know are you want to display the data in a paging Grid?
  • Yes, we have the page numbers in grid for user to select. We want to display all the records in paging grid as per the batch size , 10 in first run and 10 in the next. Now only 10 records are displayed, even after selecting the second page(user interaction) next 10 records are not displayed. Please help me on this issue.Attached is the screen shot of paging grid.
    Thanks a lot.