Warm tip: This article is reproduced from serverfault.com, please click

select-有没有办法处理你在 X++ 表中标记的记录?

(select - Is there a way to work with records that you marked in table on X++?)

发布于 2021-02-10 12:32:35

我想使用选定(标记)的表记录,示例 - 我在表中有 10 条记录,我标记了其中的 5 条。预期 - 当我使用选定的记录时,它应该只查看那 5 条记录,而不是整个 10 条。

到目前为止,我有这个选择所有记录的代码:

while select Table
                where table.JournalId == table.JournalId

有没有办法让它只选择标记的记录,而不是所有的?那个选择是在课堂上写的。我需要将那些标记的记录放入编写选择的那个类中......

Questioner
Kristers Homičs
Viewed
11
rjv 2021-02-12 21:10:49

你需要将 formdatasource 对象传递到选择记录的类中,然后使用 MultiSelectionHelper 循环遍历 formdatasource 上的选定记录。

在下面的示例中,对象salesTableFormDataSource需要从表单传入你正在使用的类。显然,用你需要的任何数据源/表替换它。

MultiSelectionHelper selection = MultiSelectionHelper::construct();
selection.parmDatasource(salesTableFormDataSource);
SalesTable salesTable = selection.getFirst();

while (salesTable)
{
    //do something with your table buffer.
    salesTable = selection.getNext();
}