Solved

Pagination: Records NOT fetching properly in Custom Inquiry screen

  • 12 January 2021
  • 4 replies
  • 65 views

Userlevel 5
Badge +3

Hello Everyone,

I have created a custom inquiry screen with pagination, which will load the POReceipts by applying a few conditions.

After applying the pagination code records are loaded very fast and working as expected expect the below scenario.


Issue details.
When I filter a grid column, it is filtering and showing only the current page records but the filter is NOT applying to all the records. Could you please help me with this?

Ex: If I have total of 900 records and per page, if it is showing only 25 records. 
When I apply a filter to the grid column, it is filtering by taking only 25 records but NOT 900. 

When I debug, PXView.MaximumRows is taking 25 records and filtering them.

Sample Pagination Code:

[PXFilterable]
public PXFilteredProcessing<Customer,
FilterDAC,
Where<Customer.bAccountID, Equal<Current<FilterDAC.customerID>>, Or<Current<FilterDAC.customerID>, IsNull>>> Records;
public IEnumerable records()
{
PXSelectBase<Customer> cmd = new PXSelectJoinGroupBy<Customer,
InnerJoin<ARInvoice, On<ARInvoice.customerID, Equal<Customer.bAccountID>>>,
Where2<Where<Customer.bAccountID, Equal<Current<FilterDAC.customerID>>, Or<Current<FilterDAC.customerID>, IsNull>>,
And<ARInvoice.docDate, Equal<Current<FilterDAC.invoiceDate>>>>,
Aggregate<GroupBy<Customer.acctCD>>>(this);
int startRow = PXView.StartRow;
int totalRows = 0;
foreach (PXResult<Customer, ARInvoice> row in cmd.View.Select(new[] { Filter.Current }, null, PXView.Searches,
PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows))
{
Customer cust = (Customer)row;
var existingRow = (Customer)Records.Cache.Locate(cust);
yield return existingRow ?? (Customer)row;
}
PXView.StartRow = 0;
}
icon

Best answer by Naveen B 24 April 2021, 13:23

Hello Everyone, 
I have raised the support ticket for this issue and below is the response from Acumatica support team.

 

Since filtering is usually performed on the DB side in such a case with view delegate and implemented pagination it would not work with calculated fields.

Please try to remove the paging logic from the view delegate to enable the filtering. This will cause some performance reduction.

 

View original

4 replies

Userlevel 5
Badge +3

Hello Everyone, 
I have raised the support ticket for this issue and below is the response from Acumatica support team.

 

Since filtering is usually performed on the DB side in such a case with view delegate and implemented pagination it would not work with calculated fields.

Please try to remove the paging logic from the view delegate to enable the filtering. This will cause some performance reduction.

 

Userlevel 5
Badge +2

@Naveen B 
Hello captain, You know I am not good at coding.
But I am just wondering in what kind of business need that you decided to do the inquiry by coding instead of to customize a Generiy inquiry.
So my little suggestion is , do we have to possiblity to fulfill your need using GI?

Userlevel 5
Badge +3

Hi @ray20 

Actually the main purpose of this screen is to show the Purchase Accrual details with many calculated fields.

This we can not achieve through the normal Generic Inquiry, hence we implemented withe Custom Inquiry screen(where we can write the coding for calculated fields).

Since we have huge records in the client instance, we have implemented with pagination to fetch records immediately.

Observed that when we have pagination for the calculated fields, filers are NOT working as expected, hence we reach out to support from Acumatica.

Finally, we got the response from Acumatica as above..

 

 

 

Userlevel 5
Badge +2

@Naveen B  Thank you for the sharing. I might use this one day.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved