On an Item Card Page, there is a selection of Item Category which has a Code field.
So in Sales Quote I have selected 2 items; 1) Front Hub 2) Bicycle and these two items have a Item Category Code set (lets say Chair, Desk respectively) in their Item Card Page. I will print Chair / Desk in the report of Sales Quote.
I am approaching this be first finding Item Category Codes for the Line Items and then putting them in an array, then I will compare and move distinct ones (reason for finding distinct is if 2 items have same Item Category Codes I have to print that Code ONLY once, so if 3 Line Items have Desk, Desk, Chair, I will print on the report Desk / Chair) into another array then concatenate the values with ' / ' into a Text Variable. Here is what I have done so far but got stuck in getting right values into my array.
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;
Upon printing the myArray[1] and [2] I do not get the correct Item Category Code Chair for my Item FrontHub and Desk for my Item Bicycle. I get incorrect values. Thanks a ton in advance for any guidance.
What you are looking for is not array. It is temporary table.
You need to define table variable of Item Category as temporary and then just
If not TempCategoryCode.Insert then ; //do nothing
This will get you a table filled with unique codes.