Hi Experts,
I was trying to calulate quantiy id same item taken twice in line level , or trice for by using Record Variable RecPurchaseLine1 and Repeat until for that item total quantity will calaculated for single item single quantity taken no need to use Repeat now problem is Repeated item in linewasie it will again add value in quantity and makes it double if same item comes trice it will triple total quantity can i calculate quantity only once if item repeated for next same item iteration it will not calculate value as double or tiple
dataitem("Purchase Header"; "Purchase Header")
{
DataItemLink = "Order Date" = field("Period Start");
DataItemTableView = where("No." = filter(<> 'PO-160019' & <> 'PO-160022' & <> 'PO-160021' & <> 'D/L-180008' & <> 'PO-160098' & <> 'IMPORD-160117' & <> 'T/I-170046'), Status = filter(<> "Pending Approval"));
RequestFilterFields = "Buy-from Vendor No.";
column(Txt; Txt)
{
}
column(No_PurchaseHeader; "Purchase Header"."No.")
{
}
column(PostingDate_PurchaseHeader; "Purchase Header"."Posting Date")
{
}
column(OrderDate_PurchaseHeader; "Purchase Header"."Order Date")
{
}
column(Location; Loc)
dataitem("Purch. Inv. Line"; "Purch. Inv. Line")
{
DataItemTableView = where("Location Code" = filter(<> ''), Type = filter(Item));
RequestFilterFields = "Posting Date", "Location Code";
column(LineAmount_PurchInvLine; "Purch. Inv. Line"."Line Amount")
{
}
column(DocumentNo_PurchInvLine; "Purch. Inv. Line"."Document No.")
{
}
column(No_PurchInvLine; Recitem.Description)
{
trigger OnAfterGetRecord();
Clear(PurchLineQty);
RecPurchaseLine1.Reset();
RecPurchaseLine1.SetRange(RecPurchaseLine1."Document No.", "Document No.");
RecPurchaseLine1.SetRange(RecPurchaseLine1.Type, RecPurchaseLine1.Type::Item);
RecPurchaseLine1.SetRange(RecPurchaseLine1."No.", "No.");
if RecPurchaseLine1.FindFirst() then
repeat
PurchLineQty += RecPurchaseLine1.Quantity;
until RecPurchaseLine1.next = 0;