Line 2: Item No: 10001 - Style Name: Shirt - Color Name: Black - Construction code: ''
Line 3: Item No: 10000 - Style Name: Shirt - Color Name: Black - Construction code: Ply
To address this, I've implemented a condition named /SalesLineCombinationExist/ to verify and filter records based on the style name, color name, and construction code. If a matching record is found, the system will exit with a result of 'false.' Conversely, if no matching values are detected, the system will exit with a result of 'true' and insert the information into a temporary folder for further processing.
The issue with the code below is that despite variations among these lines, they all pass through the 'else' condition, resulting in the addition of values to the temporary table. Could you explain why duplicate values aren't being identified within the 'if TempSalesLine.FindFirst()' section? If this approach is incorrect, could you guide me on the correct methodology?
TempSalesLine.SetRange(/DDISCH Color Name/, SalesLine./DDISCH Color Name/);
TempSalesLine.SetRange(/DDISCH Construction Code/, SalesLine./DDISCH Construction Code/);
exit(false)
else begin
// Combination doesn't exist, insert into TempSalesLine table
TempSalesLine.Init();
TempSalesLine./Document Type/ := SalesLine./Document Type/;
TempSalesLine./Document No./ := SalesLine./No./;
TempSalesLine./Line No./ := SalesLine./Line No./;
TempSalesLine./DDISCH Style Name/ := SalesLine./DDISCH Style Name/;
TempSalesLine./DDISCH Color Name/ := SalesLine./DDISCH Color Name/;
TempSalesLine./DDISCH Construction Code/ := SalesLine./DDISCH Construction Code/;
TempSalesLine.Insert(true);
exit(true);
end;