Acumatica-获取最后显示的记录

Acumatica-获取最后显示的记录,acumatica,Acumatica,有没有一种雄辩的方法,或多或少地,在Acumatica中获得网格中最后显示的记录?比如说,即使他们做了所有的排序和重新排列,是否有一种方法,例如,当按下网格上的按钮时,获取最后一条记录?基本上,我希望将该记录复制为新记录。为按钮创建一个PXAction。 在PXAction中,在数据视图中迭代直到最后一条记录。 例如,如果绑定到栅格的数据视图的名称为Yz线,而栅格线(DAC)中的对象类型为Yz,则可以是: Yz lastLine; foreach (Yz line in YzLines.Sele

有没有一种雄辩的方法,或多或少地,在Acumatica中获得网格中最后显示的记录?比如说,即使他们做了所有的排序和重新排列,是否有一种方法,例如,当按下网格上的按钮时,获取最后一条记录?基本上,我希望将该记录复制为新记录。

为按钮创建一个PXAction。 在PXAction中,在数据视图中迭代直到最后一条记录。 例如,如果绑定到栅格的数据视图的名称为Yz线,而栅格线(DAC)中的对象类型为Yz,则可以是:

Yz lastLine;
foreach (Yz line in YzLines.Select()) 
   lastLine = line;
要获取最后一条记录,还可以使用.last()或.LastOrDefault()

如果根据客户端排序需要最后一条记录,则应实现数据视图委托,如下所示:

protected virtual IEnumerable yzLines()
{
    PXSelectBase<Yz> cmd =
        new PXSelectJoinGroupBy<Yz, ...>(this);

    int startRow = PXView.StartRow; //Get starting row of the current page
    int totalRows = 0;

    foreach (PXResult<Yz> res in
                            cmd.View.Select(null, null,
                            PXView.Searches,
                            ARDocumentList.View.GetExternalSorts(),//Get sorting fields
                            ARDocumentList.View.GetExternalDescendings(),//Get sorting direction
                            ARDocumentList.View.GetExternalFilters(),//Get filters
                            ref startRow,
                            PXView.MaximumRows, //Get count of records in the page
                            ref totalRows))
    {
        //processing of records
    }

    PXView.StartRow = 0;//Reset starting row
}
受保护的虚拟IEnumerable行()
{
PXSelectBase命令=
新PXSelectJoinGroupBy(此);
int startRow=PXView.startRow;//获取当前页面的起始行
int totalRows=0;
foreach(PXRES)结果在
cmd.View.Select(null,null,
PXView.search,
ArdDocumentList.View.GetExternalSorts(),//获取排序字段
ArdDocumentList.View.GetExternalDegensions(),//获取排序方向
ArdDocumentList.View.GetExternalFilters(),//获取筛选器
斯塔特罗裁判,
PXView.MaximumRows,//获取页面中记录的计数
参考总行数)
{
//记录的处理
}
PXView.StartRow=0;//重置起始行
}

为按钮创建一个动作。 在PXAction中,在数据视图中迭代直到最后一条记录。 例如,如果绑定到栅格的数据视图的名称为Yz线,而栅格线(DAC)中的对象类型为Yz,则可以是:

Yz lastLine;
foreach (Yz line in YzLines.Select()) 
   lastLine = line;
要获取最后一条记录,还可以使用.last()或.LastOrDefault()

如果根据客户端排序需要最后一条记录,则应实现数据视图委托,如下所示:

protected virtual IEnumerable yzLines()
{
    PXSelectBase<Yz> cmd =
        new PXSelectJoinGroupBy<Yz, ...>(this);

    int startRow = PXView.StartRow; //Get starting row of the current page
    int totalRows = 0;

    foreach (PXResult<Yz> res in
                            cmd.View.Select(null, null,
                            PXView.Searches,
                            ARDocumentList.View.GetExternalSorts(),//Get sorting fields
                            ARDocumentList.View.GetExternalDescendings(),//Get sorting direction
                            ARDocumentList.View.GetExternalFilters(),//Get filters
                            ref startRow,
                            PXView.MaximumRows, //Get count of records in the page
                            ref totalRows))
    {
        //processing of records
    }

    PXView.StartRow = 0;//Reset starting row
}
受保护的虚拟IEnumerable行()
{
PXSelectBase命令=
新PXSelectJoinGroupBy(此);
int startRow=PXView.startRow;//获取当前页面的起始行
int totalRows=0;
foreach(PXRES)结果在
cmd.View.Select(null,null,
PXView.search,
ArdDocumentList.View.GetExternalSorts(),//获取排序字段
ArdDocumentList.View.GetExternalDegensions(),//获取排序方向
ArdDocumentList.View.GetExternalFilters(),//获取筛选器
斯塔特罗裁判,
PXView.MaximumRows,//获取页面中记录的计数
参考总行数)
{
//记录的处理
}
PXView.StartRow=0;//重置起始行
}

这会在网格中显示最后一条记录吗?我以为OP想要最后一条记录,考虑到排序和分页。类似于视图委托:选择(PXView.Currents,PXView.Parameters,PXView.Searches,PXView.SortColumns,PXView.Filters,ref startrow,PXView.MaximumRows,ref totalrow),否则YzLines.Select().LastOrDefault()就可以了。Ilya,你发布的示例不起作用。它不考虑它们是否对列进行排序或移动@有没有PXView的例子?在这种情况下,您会碰巧拥有它吗?斯坦,如果您需要考虑客户机排序,您应该编写一个数据视图委托(我已将代码示例发布到原始答案中)。有关数据视图学员的详细信息,请参见T200课程和help.acumatica.com。谢谢,Ilya。今天晚些时候我会试试这个。如果您希望避免复制原始BQL,以下内容也会有所帮助:这会在网格中显示最后一条记录吗?我以为OP想要最后一条记录,考虑到排序和分页。类似于视图委托:选择(PXView.Currents,PXView.Parameters,PXView.Searches,PXView.SortColumns,PXView.Filters,ref startrow,PXView.MaximumRows,ref totalrow),否则YzLines.Select().LastOrDefault()就可以了。Ilya,你发布的示例不起作用。它不考虑它们是否对列进行排序或移动@有没有PXView的例子?在这种情况下,您会碰巧拥有它吗?斯坦,如果您需要考虑客户机排序,您应该编写一个数据视图委托(我已将代码示例发布到原始答案中)。有关数据视图学员的详细信息,请参见T200课程和help.acumatica.com。谢谢,Ilya。今天晚些时候我会试试这个。如果您希望避免复制原始BQL,以下内容也会有所帮助: