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

  • @sikhivahans : Implemented as you suggested.Gave "Rows per page" as 50. Can you please elaborate how this will decrease memory threshold load. Because I have seen that all records are fetched at once.
  • @sikhivahans: This was the initial implementation which caused Memory Threshold error.
  • Need some alternative which will dynamically increase the batch size for a!pagingInfo(startIndex: 1,batchSize: 60). For example total 120 records from DB, 60 records in the first batch and 60 in the next batch. Now only first 60 records are fetched but not the records 61-120.
  • @saicharanb Two questions for you:
    1. When you set the number of records as 50, did you also use data!pagingInfo while invoking the query rule?
    2. Are you experiencing any error visually?
    3. I did suggest an alternative already of getting the data in the process and then giving it to interface. Have you had a chance to go through and implement it? This obviously resolves the issue but I would like you to implement the total number of records and data!pagingInfo in the query rule properly and then move to the approach as suggested by me.

    I can give a example of what I did: I do have a query rule which gets all the records from a data store entity and this fails because there was lots of data in the table. What I did was, I used the same query rule in the paging grid of the Forms Designer. I have configured the total number of rows as 10 and passed the data!pagingInfo to the query rule. Neither I saw any threshold errors nor a problem with the update in paging info.
  • @sikhivahans: Thank you very much for your detailed explanation. Very much useful.
    What I did was, Query remains same which fetches all the records, changed RowsPerPage as 20 and passed data!pageInfo. When I try to test from the expression rule, I am still facing "Memory Threshold error". Please find the screen shots attached and help me on this.
  • @sikhivahans: 1. Yes I am using data!pagingInfo when I reduced RowsPerPage.
    2.Yes, I am facing the below error visually -
    Error evaluating function 'queryruleexec' : Memory threshold reached during output conversion (rule: [WFT_getRequestDetailsBySearchParams], type: [WFTRequestDetailsDT863], threshold: [1,048,576 bytes], objects successfully converted: [493]))
    com.appiancorp.process.expression.ExpressionRuntimeException$AppianExceptionProvider: Expression evaluation error in rule 'wft_getrequestdetailsbysearchparams' (called by rule 'wft_temposearchquery') at function 'queryruleexec': Error evaluating function 'queryruleexec' : Memory threshold reached during output conversion (rule: [WFT_getRequestDetailsBySearchParams], type: [WFTRequestDetailsDT863], threshold: [1,048,576 bytes], objects successfully converted: [493]) (APNX-1-4198-000)

    3. Different query rules with different batch size, how do I join/integrate two queryRules. For example: I have two query Rules, How to call both in my data set.
  • @sikhivahans: I have tried to get data from query rule into a pv variable. In the page grid I called something like - todatasubset(pv!queriedData,data!pagingInfo). I am facing the below error:

    In the configured data set, the “data” field does not have the same number of elements as the “identifiers” field: “data” has 0 items and “identifiers” has 1 items.
  • I have a query rule : =rule!Pagination(pv!wftRequestID,pv!salesOffice,pv!requestStatus,a!pagingInfo(startIndex: 1,batchSize: 100),loggedinuser()) which is returning me 100 records. Now after this, I need to retrieve records 201 to 300. Do I need to implement another rule with =rule!Pagination(pv!wftRequestID,pv!salesOffice,pv!requestStatus,a!pagingInfo(startIndex: 101,batchSize: 200),loggedinuser()) ? If so how do I integrate these two rules ?