如何检索过滤的记录

时间:2018-10-18 08:56:37

标签: acumatica

说“我的交易”视图有五行。

enter image description here

如果我在“数量”上设置过滤器以仅显示少于10个的

enter image description here

我将以这个结尾:

enter image description here

我的问题是,如何访问网格中显示的两条记录? Transactions.Select()给了我全部/未过滤的五行。我已经实现了视图委托,可以从那里看到过滤的行。但是它们是否作为缓存的对象或其他东西存储在其他地方?

TIA

2 个答案:

答案 0 :(得分:1)

下面的示例在AR Document Release上创建一个按钮,将所有记录标记为已选择,包括已定义的过滤:

public PXAction<BalancedARDocument> SelectAll;

    [PXButton]
    [PXUIField(DisplayName = "Select All")]
    protected virtual void selectAll()
    {
        int min = 0;
        int totalRows = 0;

        foreach (PXResult<BalancedARDocument, ARDocumentRelease.ARInvoice, ARDocumentRelease.ARPayment, Customer, ARAdjust> doc in Base.ARDocumentList.View.Select(null, null, PXView.Searches, Base.ARDocumentList.View.GetExternalSorts(), Base.ARDocumentList.View.GetExternalDescendings(), Base.ARDocumentList.View.GetExternalFilters() ?? new PXFilterRow[0], ref min, 0, ref totalRows))
        {
            (doc[typeof(BalancedARDocument)] as BalancedARDocument).Selected = true;
            Base.ARDocumentList.Update(doc);
        }
    }

答案 1 :(得分:0)

存储在PXView对象中的筛选器,可以通过选择的View属性来访问。您可以使用具有多个参数的Select方法来检索过滤的记录:

var startRow = PXView.StartRow;
int totalRows = 0;
var list = Transactions.View.Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters,
                ref startRow, PXView.MaximumRows, ref totalRows);