Tips for Scripting

Optiva scripting follows the same conventions as Visual Basic .NET scripting. These suggestions are not requirements for Optiva scripting.

  • If you are going to use a variable in a print statement, ensure that the variable is assigned a value.
    
    Dim oItemcode As Object = ObjProperty("ITEMCODE","FORMULA", 
    "PIZZASAUCE\003")
    MessageList("The code is: ",oItemcode)
    
  • Show the object type with variables. A suggested convention is to add a prefix letter to a variable to denote an object type. For example, use the letter “o” in front of a variable if the return is an object data type. Then as variables are used throughout the script, away from where they were originally declared, you can identify their data type.
    
    Dim oItemcode As Object = ObjProperty("ITEMCODE","FORMULA", 
    "PIZZASAUCE\003")
    
  • Comments can be either on a separate line of the script or at the end of a line.
    
    'Declare an object variable.
    Dim oitemCode As Object 'This declares the variable.
    
  • Avoid the STATUSIND shortcut. As a convenience, STATUSIND is provided for read-only values. In general, you should use the full syntax of STATUSIND.STATUS.
    
    Dim oStatus As Object = ObjProperty("STATUSIND.STATUS", "FORMULA", 
    "PIZZA\001")
    

    OR

    
    ObjPropertySet(300, 1, "STATUSIND.STATUS", "FORMULA", "PIZZA\001")