Hi, i added a new Type to the Purch Lines, nl "Set".
I got my own table Set, Contains a code and a description.
Some items refer to a set Code for example:
I have following record in the Set Table:
Code: MTBKGR
Description: Mountainbike green
Now there are two items refering to this set:
for example:
1) Item No.: 1000
Item Description: Bike
2) Item No.: 70104
Item Description: Paint, Green
So when the users enter a Purchase Line of type set. He fills in the Set Code and the Quantity.
After entering the desired quantity new Purch Lines are created for the items who refer to the Set.
Now when the quantity is validated i added following code to the Purch Line table:
lv_LineNo := "Line No.";
lv_Item.RESET;
lv_Item.SETRANGE(lv_Item.Set,"No.");
IF lv_Item.FINDSET THEN BEGIN
REPEAT
lv_PurchLine.RESET;
lv_PurchLine."Document No." := "Document No.";
lv_PurchLine."Document Type" := "Document Type";
lv_LineNo += 100;
lv_PurchLine."Line No." := lv_LineNo;
lv_PurchLine.VALIDATE(lv_PurchLine.Type,Type::Item);
lv_PurchLine.VALIDATE(lv_PurchLine."No.",lv_Item."No.");
lv_PurchLine.VALIDATE(lv_PurchLine."Location Code","Location Code");
lv_PurchLine.VALIDATE(lv_PurchLine.Quantity,Quantity);
lv_PurchLine.INSERT;
UNTIL lv_Item.NEXT = 0;
END;
This works fine, but the subform doesnt get updated?
How can i get it to update? Should i move the code to the Form's Quantity validate function?
If i do this, will the validate of the table still work?
0
Answers
I added CurrForm.UPDATE(FALSE) to the OnAfterValidate trigger of the Quantity field in the Purchase Order Subform.
Is this the correct way for my desired functionallity?
I added CurrForm.UPDATE(FALSE) to the OnAfterValidate trigger of the Quantity field in the Purchase Order Subform.
Is this the correct way for my desired functionallity?
Try putting CURRFORM.UPDATE in the OnAfterValidate of the Quantity field.
Albert
IF Type = Type::Set THEN
CurrForm.UPDATE(false);
Without the if i could not add quantities to new lines that i add after add the Set