Copy Method to assign sets and classes

This example shows how the Copy Method works during a formula copy.

  • All informational parameters that belong to the FOOD set code are cleared.
  • The item code that is assigned to the formula is removed.
  • The formula is assigned to a class. The class is chosen by the user.
  • The formula is assigned a security level of 15.
  • The formula is assigned to the COLOR set code.
  • The user is notified that the new formula does not have "FORM" in its name.
  • The yield value is converted to an integer and examined as to whether it is a whole number.

Option Strict Off
imports System
imports System.Diagnostics

Class CopyScript
Inherits FcProcFuncSetEventCopyMethod

Function execute() As Long
Dim lRemove, lRemove2, lClass1, lSecurity As Long 
Dim lNotify, lHasset, lSet1 As Long
Dim oExist1 As Object
Dim lMessage1, lMessage3, lMessage4 As Long
Dim iInteger1, iName as Integer

lRemove = ObjPropertyRemove(0,"Value.TP1","","","SET=FOOD", 2)
lRemove2 = ObjPropertyRemove(0,"ITEMCODE","","")
lClass1 = ObjPropertySet("CLASS D",1,"CLASS","","")
lSecurity = SetSecurity("","","","",15)
lNotify = Notify("JOE_SMITH","FORMULACOPY",0,0,CopyMethod.Context._OBJECTKEY, 

 CopyMethod.Context._TASKUSER)
lHasset = HasSetCodes("","","COLOR")
if lHasset=0 then
 lSet1 = AddSetCodes("","","COLOR")
end if
Dim strObjectKey as String = _OBJECTKEY
If Not strObjectKey.Contains(“FORM”) Then
                lMessage1 = MessageList(“This is not a FORM Formula”)
end if
iInteger1 = 0       'set initial value
 If IsNumeric(cStr(iName)) Then
 If CInt(iName) = iName Then
 iInteger1 = 1
 End If
 End If
 if iInteger1 = 1 then
 lMessage3 = MessageList("The yield is a whole number.")
 else
 lMessage4 = MessageList("The yield is not a whole number.")
 end if
End Function
End Class