Skip to main content

Populating Contact and PhoneNumber

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 the Terminal in the namespace in which you installed and compiled the classes. If the 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:

  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)
  4. If you are also populating PhoneNumber, follow the same procedure:

    USER>Do ##class(CSPTutorial.PhoneNumber).Populate(15)

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.

FeedbackOpens in a new tab