About classes

Class tags are compound tags that permit a high-degree of encapsulation within the Tags database. Where basic tags receive a single value, classes are designed to receive multiple values.

You can create a class-type tag by grouping basic or array tags, which then become the class members. The maximum number of members for any class depends on the product specification.

You specify class-type tags in one of two formats:

  • For a simple class tag the syntax is TagName.ClassMemberName. (Where the period is used as a separator.)

    For example, if you wanted to monitor several different conditions (such as temperature, level and pressure) in a tank, you might create a class tag as follows:

    • Tank.Temperature
    • Tank.Level
    • Tank.Pressure
  • For creating a complex class tag (using an array tag) the syntax is ArrayTagName[ArrayIndex].ClassMemberName. (Where again, the period is used as a separator.)

    If you wanted to monitor the temperature, level, and pressure conditions in multiple tanks, you might create a class tag as follows:

    • Tank[tk].Temperature
    • Tank[tk].Level
    • Tank[tk].Pressure

    Where tk is an array index, representing the tank number.

Classes Folder

The Classes folder contains all of the project classes and their respective members. Classes are compound tags consisting of user-defined data-type structures or tag types (Integer, Real, Boolean, and String). Classes allow for high-level encapsulation in the project database. A class-type tag provides a set of values for its members.

To define a class you must define the members and their types. Class members are variables that hold values for an object with particular characteristics. Thus, the defining a class can be very useful for projects with a repeating group of variables.

Note: When you create a class folder, a Class Web Studio Help icon tag class Classes Folder icon displays in the Tag List subfolder located in the Project Tags folder.

To access the members of a class, use the following syntax with a period ( . ) as the separator: TagName.MemberName. For example: tk.LEV or tk.TMP.

If the Tank tag is an array, you use the following syntax:

  ArrayTagName[ArrayIndex].MemberName  

For example: Tank[1].Level or Tank[n].Temperature

A class-type tag contains a set of values (rather than a single value) associated with the class. You create class-type tags by grouping simple tags, which become the members. The maximum number of members for any class depends on the product specification. Class members can hold standard Integer, Real, Boolean, and String values, as mentioned previously.

To create a new class, use one of the following methods to open the Insert Class dialog:

  • On the Insert tab of the ribbon, in the Global group, click Class;
  • Right-click on the Classes folder, the Members List sub-folder, or the Datasheet View icon in the Classes folder; or
  • Create a new class tag in the Project Tags folder.
When the Insert Class dialog displays, enter a class name in the Name field, and then click OK to close the dialog.
Figure 1. Insert Class dialog
Web Studio Help dialog insertclass Classes Folder

Note: You must type a unique class name. You cannot create two classes with the same name. In addition, you cannot configure shared tags and system tags as classes.

IWS saves class folders in the Tag List subfolder (located in the Project Tags folder). You can edit the classes in this folder.

When the Class datasheet displays, you can use it to create, modify, or delete any class members and their viewable properties. (You cannot edit classes from the Tag Property dialog.)
Figure 2. Class datasheet
Web Studio Help worksheet class Classes Folder

Note: The Classes folder can contain up to 16,384 classes and up to 4,096 members per class. This is a technical limitation of the tags database, not a licensing restriction; unused classes do not count against the total number of tags used.

When a new tag is created with a class type, however, each class member counts as a tag used because each member holds a value. (For example, if you create a class with 5 members and then create 5 tags with that class type, then you have a total of 25 tags used.) The total number of tags used cannot exceed the number of tags supported by the project’s target system / runtime license.

To edit a class member or property, you can right-click on the item and use standard Windows commands to cut (Ctrl+X), copy (Ctrl+C), or paste (Ctrl+V). You can also undo (Ctrl+Z) the last modification to a field.

You also edit member properties as follows:

  • Name field: Type a name for the member or member property. The first character must be a letter and you can use up to 255 characters in the name.
  • Type combo-box: Select a member type (Boolean, Integer, Real, or String).
  • Description field: Type a description of the member property for documentation purposes.
Note: Members of a class cannot be of another class type.

Also, you must create a unique class name. You cannot reuse the name of an existing class. However, you can create members with the same name in different classes.

To delete a class and all its members, right-click on a class folder and select delete. IWS disables the delete option if you are running any runtime tasks. In addition, you cannot delete a class if it is associated with any tag.

Classes Folder