I have a form (card) which uses the Purchase Header, and a subform (tabular) that uses the Purchase Line table. What I want to do is clear the “Qty To Receive” value from the Purchase Line records, then put them into the subform. (OnAfterGetRecord does this nicely). BUT - after the form has been loaded - I don’t want to clear the “Qty to Receive” value again. The user keys into the Qty to Receive field the value that is being received, and I need to keep those entries. The problem is, with the code to clear the value in the OnAfterGetRecord trigger, anytime I move back onto the record, the “Qty to Receive” value is cleared! [B)]BOO!!! Is there not a trigger I can use that occurs after the subform is fully populated, and prior to anything else being done? If so I could set a boolean to stop the clearing. Any Suggestions GREATLY appreciated.
Hi Faithie! Maybe this could help: Create a FlowField e.g. “Receive Qty. Complete” in the “Purchase Header” with such a CalcFormular Exist(“Purchase Line” WHERE (Qty. to Receive=FILTER(0))) Now you can check this value in OnAfterGetRecord of your Subform “Purchase Line” and decide if to clear the quantity or not: PurchaseHeader.GET("Document Type","Document No."); PurchaseHeader.CALCFIELDS("Receive Qty. Complete"); IF NOT PurchaseHeader."Receive Qty. Complete" THEN "Qty. to Receive" := 0;
Ok, this would allways clear the quantity, even if one line is not filled … Kind regards, Jörg
Do you want to initialize this value to 0 (rather than the quantity), or have the value set to 0 each time the form is accessed (and kept as long as the form is open)? The most logical is to initialize the value to 0…This is covered elsewhere in the forum. If you want to keep a value as long as the form is open, you will have to worry about multiple users.
Forgive me for taking so long to reply back…wrong email address on profile… I’m finding out that this isn’t the kind of change I want in the form. I think a change to the use of the “Qty. to Receive” field to not be a reflection of the Outstanding Quantity, but instead, be the value being received, would be more appropriate. Thanks.
Hi Faithie, You probably dont need this anymore, but I have only just rejoined after a 1 year absence. Personally I cringe whenever I hear modifications with the “Qty. to Receive” from my NSC’s clients and try to avoid this wherever possible due to this field being updated by the system each time a posting has been made.[V] I try to use a bit of lateral thinking and I think I have had a similar request to the one you have. If I am reading between the lines correctly, you have a problem that users forget to clear lines when they are not being received and they end up posting all the lines [?] how about creating a boolean flag that only posts the lines where this field has been ticked which therefore leaves the “Qty. to Recieve” functionality standard and only posts lines that SHOULD be posted. I have used this solution with great sucess in purchases and Sales (shipping) for some of my less confident (and forgetful [;)] )clients.