Adding a UserValue object

  To set a user-defined value for a selected object:

  1. Define a string which contains the desired value.

    For example, type:

    MyString.
  2. Invoke the Add (Method) to create an item in the UserValues (Collection) to store this value.

    A string containing the name for this value is the only parameter needed for the Add (Method) (that is, Object.UserValues.Add(name,[optional]value).

    The Add (Method) adds the named item to the collection so that it can be accessed through the object model and can be written and read as part of the Interactive Reporting document format. The UserValue object has one method: Remove. It also has three properties as described below:

    • Name — A read-only property which returns the name of an UserValue object. The Add method creates the item with this property set to the string value specified as the argument to the method. This feature is useful when you need to enumerate the items in the collection, such as in a for loop based on the Count property of the object’s UserValues (Collection).

    • Value — A property of the string type, which is read/write. The Add method creates the item with the Value (Property) set to the empty string ("") unless the optional second parameter, which is of type string, sets the value.

    • ReadOnly A property of the Boolean type, which is read-only. The Add (Method) creates the item with the read-only property set to false.

      The Add (Method) increments the Count (Property) of the object’s UserValues (Collection) by one.

      When the document containing this item is saved, it stores the collection containing the item so that it is documentable. Consequently, any external software systems can follow the documentation to add user-defined values directly into an Interactive Reporting document format.

      Errors resulting from adding the UserValue object get written to the Console window. Typically, errors result from these conditions:

    • Memory that cannot be allocated to hold the item

    • An item of the same name already exists.

  3. Assign or reassign the Value property of the UserValue object. For example, you might type:

    Object.UserValues[name].Value=sMyString.