Sample rule

This rule enables you to create formulas during a Copy event. During the formula copy, the Copy Method is used to achieve these tasks:

  • 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 that is chosen by the user.
  • The formula is assigned to the COLOR set code.

The formula name COLOR.037-BLUE-CS/001 has five segments. An additional segment is included to enable the user to select the class of the new object. The class is not part of the name.

The class is also a selection type. Here is how the name is defined.

  • lab=FIXED (COLOR)
  • formula number = SEQUENCE (037)
  • color = SELECTION (BLUE)
  • user’s initials = PROMPT (CS)
  • version = VERSION(001)
  1. The rule copies formulas. Copy Methods and Auto Code are enabled.
  2. Define the Copy Methods in the Copy Methods form. The object and reference type must match what is on the Create Rule form.

    • Specify Formula for the Object Type.
    • Leave the Reference Type field blank.
    • Specify Child for the Default Genealogy.
  3. Add the script to the Copy Script tab. See the Infor PLM for Process Scripting Administration Guide for more information about creating scripts for copy methods.

    
    Option Strict Off
    Imports System
    Imports System.Diagnostics
    
    Imports Microsoft.VisualBasic
    
    Class CopyScript
    Inherits FcProcFuncSetEventCopyMethod
    
    Function execute() As Long
       Dim_remove As Long
       Dim remove2 As Long
       Dim class As Long
       Dim hasset As Long
       Dim set As Long
    
       remove = ObjPropertyRemove(0,"VALUE.TP1","","","SET=FOOD",2)
       remove2 = ObjPropertyRemove(0,"ITEMCODE","","")
       class = ObjPropertySet("[%1]",1,"CLASS","","")
    
       hasset = CopyMethod.hasSetCodes
       if(hasset = 0 then
          set=CopyMethod.addSetCodes("","","COLOR")
       end if
    
       End Function
    End Class