Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 2.39 KB

PX1010.md

File metadata and controls

62 lines (45 loc) · 2.39 KB

PX1010

This document describes the PX1010 diagnostic.

Summary

Code Short Description Type Code Fix
PX1010 If a delegate applies paging in an inner select, StartRow must be reset. (If StartRow is not reset, paging will be applied twice.) Warning (ISV Level 1: Significant) Available

Diagnostic Description

If a delegate applies paging in an inner select, PXView.StartRow must be set to 0. If StartRow is not reset, paging is applied twice.

The code fix adds PXView.StartRow = 0; before the return from the delegate. This code fix supports multiple return statements.

For iterator methods, the warning message is shown but the code fix is not available.

Example of Code that Results in the Warning

public class LEPMaint : PXGraph<LEPMaint>
{
    public PXSelect<ListEntryPoint> Items;
  
    public IEnumerable items()
    {
        int startRow = PXView.StartRow;
        int totalRows = 0;
  
        IEnumerable<ListEntryPoint> rows = new PXView(this, false, new Select<ListEntryPoint>()) // The PX1010 warning is displayed for this line.
                .Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters,
                ref startRow, PXView.MaximumRows, ref totalRows).Cast<ListEntryPoint>();
  
        return rows;
    }
}

Example of Code Fix

public class LEPMaint : PXGraph<LEPMaint>
{
    public PXSelect<ListEntryPoint> Items;
  
    public IEnumerable items()
    {
        int startRow = PXView.StartRow;
        int totalRows = 0;
  
        IEnumerable<ListEntryPoint> rows = new PXView(this, false, new Select<ListEntryPoint>())
                .Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters,
                ref startRow, PXView.MaximumRows, ref totalRows).Cast<ListEntryPoint>();

        PXView.StartRow = 0;  
        return rows;
    }
}

Related Articles

PXView.StartRow