Caché Server Pages QuickStart
Populating Contact and PhoneNumber
[Home] [Back] 
InterSystems: The power behind what matters   
Class Reference   
Search:    

After importing an XML file containing the class definition for CSPTutorial.Contact or CSPTutorial.Contact and PhoneNumber, you can populate Caché with sample instances of the classes. Here's how:

  1. Compile the classes. You can do this in Studio by clicking Build —> Compile.
  2. Open Terminal in the namespace in which you installed and compiled the classes. If Terminal does not open in the correct namespace, use the ZN command to change namespaces. For example, if the terminal opens in the SAMPLES namespace and the classes are installed in USER do the following:
    SAMPLES>ZN "USER"
    
    USER>
    
  3. Populate Contact by invoking the Populate method. The single integer argument specifies the number of instances to create. Note that because of their parent-child relationship, you must populate Contact before you populate PhoneNumber.
    USER>Do ##class(CSPTutorial.Contact).Populate(5)
    
    USER>
    
  4. If you are also populating PhoneNumber, follow the same procedure:
    USER>Do ##class(CSPTutorial.PhoneNumber).Populate(15)
    
    USER>
    
Note:
You must populate CSPTutorial.Contact before you populate CSPTutorial.PhoneNumber. This is due to the relationship between the two classes.
To learn more about the Caché Data Population Utility, read The Caché Data Population Utility in Using Caché Objects.