簡體   English   中英

Acumatica-獲取最后顯示的記錄

[英]Acumatica - get the last displayed record

是否有一種雄辯的方法或多或少地獲得了Acumatica網格中最后顯示的記錄? 假設即使他們進行了所有排序和重新排列,是否還有其他方法例如在按網格上的按鈕以獲取最后一條記錄時? 基本上,我想將該記錄復制為新記錄。

為您的按鈕創建一個PXAction。 在PXAction內部,在數據視圖中進行迭代,直到最后一條記錄。 例如,如果綁定到網格的數據視圖的名稱是YzLines,而網格線(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
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM