Copy methods

Use copy methods if you are going to create new formulas. For example, change the status of formulas and specify the values of extension fields.


Option Strict Off
imports System
imports System.Diagnostics
module Script
Function execute() As Long

'Retrieve the Formula Code of the object being copied
Dim sOldCode as String=cStr(CopyMethod.ObjProperty("KEYCODE", "", 
_OLDCODE))
Dim sOldVersion as String=cStr(CopyMethod.ObjProperty("KEYCODE2", "", 
_OLDVER))
Dim sKeyCode as String=cStr(CopyMethod.ObjProperty("KEYCODE", "", 
_MODELOBJECTKEY))

'Retrieve the value of Status
Dim sStatus as String=cStr(ObjProperty("STATUSIND.STATUS"))
Dim dToday as Date = now()

'Set the Supercedecode field to the Formula Code of the copied object
ObjPropertySet(sKeyCode, 1, "SUPERCEDECODE", "", "")
'Set the Superceded version to the version of the copied object.
ObjPropertySet( _OLDVER, 1, "SUPERCEDEVERSION", "", "")
'Set the Superceded Date to the current date.
ObjPropertySet(dToday, 1, "SUPERCEDEDATE", "", "")
'Set the Superceded Date to the current date.
ObjPropertySet(20, 0, "VALUE.STATUS", "", "", "STATUSIND.STATUS", 1) 
'End if

end Function
end module