I need to insert new lines in order. The order line has a field called 'suborder code' and I need to insert a line per 'suborder code'.
To achieve this I created a key in the order line table with (suborder code, line no).
Then created a processing report. In the processing report, I added the order line table and add sort by the new key.
I wrote the code to insert a line at the last of the table but I want to insert a new line every time when 'suborder code' is change.
Thank you!
Answers
When looping through your record set store your Code in a variable.
When your old Code <> Current Code, FindLast on your table with the old SubOrder Code and Insert a new Line.
Hope this helps.
BR,
KG
You can use select distinct with List variable,like this sample.
procedure RetrieveNames()
var
customer: record Customer;
customerNamesList: List of [Text];
begin
if customer.FindSet() then
repeat
begin
if not customerNamesList.Contains(customer.Name) then
customerNamesList.Add(customer.Name);
end
until customer.Next = 0;
foreach name in customerNamesList do
Message(name); //use your inser function
end;
Thanks.