Dear all,
I have created a Table, say Packing Lines. Primary keys are :- "Document Type","Sales Doc. No.","Sales Doc. Line No.",Item,"Line No.".
There is a "Quantity" field in this Table. I want to sum up this field's value at time of entring value. So I have written a Function Say CheckSaleInvoiceLineQty and call this function in the Quantity - OnValidate()
CheckSaleInvoiceLineQty()
TotQty :=0;
PackingLines.SETCURRENTKEY("Document Type","Sales Doc. No.","Sales Doc. Line No.",Item,"Line No.");
PackingLines.SETRANGE("Document Type","Document Type");
PackingLines.SETRANGE("Sales Doc. No.","Sales Doc. No.");
PackingLines.SETRANGE("Sales Doc. Line No.","Sales Doc. Line No.");
IF PackingLines.FINDSET THEN
REPEAT
TotQty+= PackingLines.Quantity ;
UNTIL PackingLines.NEXT = 0;
When I am entering any value in the quantity field the function is executed and enter into the REPEAT
UNTIL Loop , but finds PackingLines.Quantity =0 value.
why ?
:shock: :shock: :shock:
Comments
CheckSaleInvoiceLineQty()
you're reading a record variable, it means that if ther record is not committed to the database, you won't see it in an instance of your table.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
This is not working correctly! :shock: :shock: :shock:
Try this code ....
What is Qty? I assume that you need to add Rec.Quantity and not Qty...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Qty is a parameter.Which is nothing but Rec.Quantity .
Could you describe some example of data an the result?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I'm creating the Packing List lines against a Sales Invoice Line. And try to block that The Packing Lines total quantity could not exceed the Sales Line Quantity
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.