Skip to main content
Question

How to properly limit records in a View Delegate without breaking pagination on a Process Screen?

  • December 7, 2025
  • 1 reply
  • 14 views

Forum|alt.badge.img+1

I’m working on a customization for a Process Screen in Acumatica and ran into an issue related to correct pagination when using a View Delegate.

Here is the goal:

I need to build a View where for each Equipment I calculate the maximum Appointment date. This part works fine using a Projection.

Next, I need to calculate the difference between the Business Date and the Max(AppointmentDate) for each Equipment.

Then I need to filter records where this difference is greater than 10 days.

Since filtering by a computed value cannot be done within the Projection, I implemented the filtering inside a View Delegate.

The problem is that when I filter the records in the Delegate, Acumatica receives fewer records than expected. As a result, the StartRow and pagination logic break, because the system still thinks the dataset contains more rows than what I actually return.

What is the correct way to implement filtering based on a calculated value (difference of dates), but without breaking pagination on a Process Screen?
Is there a recommended approach to properly handle startRow, maximumRows, or to return the correct total record count inside a View Delegate?

Any advice or working examples would be greatly appreciated.

1 reply

Forum|alt.badge.img+1

Hi ​@bihalivan15 

Try using PXDelegateResult. The text and code example below are from the T250 course documentation.
 

When you are implementing a data view delegate, we recommend that you store the results of its dynamic query in
an object of the PXDelegateResult class and specify whether the query results are already filtered, truncated
(to fit the page), and sorted. Repeated operations are not applied to the PXDelegateResult objects. So if you
do not set IsResultFiltered, IsResultTruncated, or IsResultSorted to true, the platform will, respectively, filter, truncate, or sort the retrieved data aer it is obtained from the database. The following code
shows an example of how to use the PXDelegateResult class in a data view delegate.

protected virtual IEnumerable ardocumentlist()
{
PXSelectBase<BalancedARDocument> cmd =
new PXSelectJoinGroupBy<BalancedARDocument,
...
//Set the necessary sorting fields: use the key fields
OrderBy<Asc<BalancedARDocument.docType,
Asc<BalancedARDocument.refNbr>>>>
(this);
PXDelegateResult delegResult = new PXDelegateResult
{
IsResultFiltered = true,
IsResultTruncated = true,
IsResultSorted = true
}
foreach (PXResult<BalancedARDocument> res_record in cmd.SelectWithViewContext())
{
// add the code to process res_record
delegResult.Add(res_record);
}
return delegResult;
}