将元素添加到数组中然后找到不同的,

Add elements into an array then find distinct,

On an Item Card Page, there is a selection of Item Category which has a Code field.

所以在销售报价中我选择了 2 个项目; 1) 前花鼓 2) 自行车 这两个项目在其项目卡页面中设置了项目类别代码(分别为椅子、书桌)。我会在 Sales Quote 的报告中打印 Chair / Desk。

我正在处理这个问题,首先找到行项目的项目类别代码,然后将它们放入一个数组中,然后我将比较并移动不同的项目(找到不同的原因是如果 2 个项目具有相同的项目类别代码我只需打印该代码一次,因此如果 3 个行项目有 Desk、Desk、Chair,我将在报告 Desk / Chair 上打印到另一个数组中,然后将值与“/”连接到一个文本变量中。 这是我到目前为止所做的,但一直无法将正确的值放入我的数组中。

On the OnAfterGetRecord Trigger of my Sales Quote Report
I have written;
ItemCateTableRec.Reset();
ItemCateTableRec.SetFilter(Code, "Sales Line"."Item Category Code");
IF ItemCateTableRec.FindSet then begin
repeat
myArray [ i ] := ItemCateTableRec.Code;
i := i + 1;
until ItemCateTableRec.Next = 0;
end;

打印 myArray[1] 和 [2] 后,我的 Item FrontHub 和 Desk 没有得到正确的 Item Category Code Chair 和 Item Bicycle。我得到不正确的值。 提前非常感谢您的指导。

您要查找的不是数组。是temporary table.

您需要将项目类别的 table 变量定义为临时变量,然后

If not TempCategoryCode.Insert then ; //do nothing 

这会给你一个 table 充满唯一代码。