Adding Properties to the CInfo.Company Class
Next, we will add some properties to the CInfo.Company class. We will add the following properties:
-
Name—the name of the company.
-
Mission—the mission statement for the company.
-
Recommendation—whether to buy or sell stock in this company.
-
PrimaryAddress—the main address of the company. As you may have guessed, we will use our CInfo.Address class for this.
Add these three properties, using either the New Property Wizard (click Class->Add->New Property); or by simply adding the property definitions to the class definition using the Studio editor. Your class should now look like this:
Class CInfo.Company Extends (
%Persistent,
%Populate,
%XML.Adaptor
)
{
Property Name As %String(POPSPEC = "Company()");
Property Mission As %String(MAXLEN = 200, POPSPEC = "Mission()");
Property Recommendation As %String(VALUELIST = ",Buy,Sell,Hold");
Property PrimaryAddress As CInfo.Address;
}
Again, note that many of the properties define parameters. We have already seen the POPSPEC parameter. We have also added a MAXLEN parameter to increase the allowed length of the Mission property (the default is 50 characters). The Recommendation property defines a VALUELIST parameter. This defines a list of allowed values (an enumeration) for this field. Make sure that the list starts with a comma (,); the first character is used to indicate what the delimiter character is.
Compile this class, using the Compile command within the Build menu.