I use a routine like this with no condition and abl code. Mine is actually in a data directive, but should work in an update method.
I don’t know if the plant record is added on the same pass that the part is made or on an update.
if you have data directives, then I would do this on the partplant table and the find would be for the part table to get the class
the caps and trim is to keep all of our part numbers uppercase and I had people pasting in numbers with spaces in front of them.
I also record who made the part and when.
Greg
/*Set default values*/
For each ttPart where ttPart.Rowmod = 'A' or ttpart.Rowmod = 'U' no-lock.
Find First PartPlant where PartPlant.company = cur-comp and PartPlant.PartNum = ttPart.Partnum
and PartPlant.Plant = 'MfgSys' and PartPlant.LeadTime = 0 no-error.
If Available PartPlant Then Do:
If ttPart.PartClassID = 'FLANGE' then
PartPlant.LeadTime = 15.
If ttPart.PartClassID = 'MOTOR' then
PartPlant.LeadTime = 90.
End.
If ttpart.RowMod = 'A' Then Do:
Assign ttpart.PartNum = caps(trim(ttpart.partnum)).
Assign ttPart.ShortChar05 = dcd-userid.
Assign ttPart.Date01 = Now.
End.
End.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Saturday, May 10, 2014 10:00 AM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Method Directive for Default Product Group on Part
I do have another one that i'm not sure how to tackle...
How would I go about a Method Dir that would use an if/then to set defaults on the PartPlant.LeadTime based on ttPart.ClassId?
For example, if the part being created has a part class of Flange, the leadtime defaults to 15, and if the part class is a motor the default leadtime would be 90, etc.
Thanks!
Sarah
CONFIDENTIALITY NOTICE
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6280 and immediately delete the communication.
"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."