Service Backed record with stored procedure.

 Hello All,

We have made a service backed record with the stored procedure and we are sending the startindex and Batchsize as a parameter to the stored procedure.

The problem is when first time the record load it hit the database 1time but when we move to next page or previous page, it is hitting the Database two time with the startIndex and batchSize of that page itself and the new page where we want to go.

The code is here:-

load(
  local!queryInformation: rule!DTI_getQueueRecordSearchRSPQuery(
    ri!rspQuery
  ),
  /* Get unique idenifier if present in filters */
  local!uniqueIdentifier: displayvalue(
    "rp!id",
    index(
      local!queryInformation.filters,
      "field",
      {}
    ),
    index(
      local!queryInformation.filters,
      "value",
      {}
    ),
    null
  ),
  /*
    If there is no unique identifier, get the record list data;
    otherwise, get the specific record using the id. 
  */
  local!response:  
  if( rule!APN_isBlank(local!uniqueIdentifier),
  rule!ExecuteStoreRule(
    startIndex: local!queryInformation.pagingInfo.startIndex,
    batchSize: local!queryInformation.pagingInfo.batchSize,
    paramter3: rule!functionABC(),
    paramter4: local!queryInformation.searchText
    ),
  rule!ExecuteStoreRule(
      startIndex: local!queryInformation.pagingInfo.startIndex,
      batchSize: local!queryInformation.pagingInfo.batchSize,
      paramter3: rule!functionABC(),
      paramter4: local!uniqueIdentifier
    )),
  
  
 
  /*
    Generate the data subset. paramter4 is our unique identifier.
    User placeholder configurations for paging and sorting.
  */

 a!dataSubset(
    data: local!response,
    identifiers: index(
      local!response,
      "paramter4",
      {}
    ),
    totalCount:  if(
      rule!APN_isBlank(local!response),0,
      index(local!response,"totalCount",1)
    ),

startIndex: local!queryInformation.pagingInfo.startIndex,
      batchSize: local!queryInformation.pagingInfo.batchSize,
  )
  
   
  
)

 

 

Thanks in Advance.

 

Thanks

Sahil Batra

Parents Reply Children
No Data

 Discussion posts and replies are publicly visible