Skip to main content

Default Behavior

Default Behavior

This section describes how the Populate() method generates data, by default, for the following kinds of properties:

The Populate() method ignores stream properties.

Literal Properties

This section describes how the Populate() method, by default, generates data for properties of the forms:

Property PropertyName as Type;
Property PropertyName;

Where Type is a datatype class.

For these properties, the Populate() method first looks at the name. Some property names are handled specially, as follows:

If the property name is any case variation of the following Populate() invokes the following method to generate data for it
NAME Name()
SSN SSN()
COMPANY Company()
TITLE Title()
PHONE USPhone()
CITY City()
STREET Street()
ZIP USZip()
MISSION Mission()
STATE USState()
COLOR Color()
PRODUCT Product()

If the property does not have one of the preceding names, then the Populate() method looks at the property type and generates suitable values. For example, if the property type is %StringOpens in a new tab, the Populate() method generates random strings (respecting the MAXLEN parameter of the property). For another example, if the property type is %IntegerOpens in a new tab, the Populate() method generates random integers (respecting the MINVAL and MAXVAL parameters of the property).

If the property does not have a type, InterSystems IRIS assumes that it is a string. This means that the Populate() method generates random strings for its values.

Exceptions

The Populate() method does not generate data for a property if the property is private, is multidimensional, is calculated, or has an initial expression.

Collection Properties

This section describes how the Populate() method, by default, generates data for properties of the forms:

Property PropertyName as List of Classname;
Property PropertyName as Array of Classname;

For such properties:

  • If the referenced class is a data type class, the Populate() method generates a list or array (as suitable) of values, using the logic described earlier for data type classes.

  • If the referenced class is a serial object, the Populate() method generates a list or array (as suitable) of serial objects, using the logic described earlier for serial objects.

  • If the referenced class is a persistent class, the Populate() method performs a random sample of the extent of the referenced class, randomly selects values from that sample, and uses those to generate a list or array (as suitable).

Properties That Refer to Serial Objects

This section describes how the Populate() method, by default, generates data for properties of the form:

Property PropertyName as SerialObject;

Where SerialObject is a class that inherits from %SerialObjectOpens in a new tab.

For such properties:

  • If the referenced class inherits from %PopulateOpens in a new tab, the Populate() method creates an instance of the class and generates property values as described in the preceding section.

  • If the referenced class does not inherit from %PopulateOpens in a new tab, the Populate() method does not generate any values for the property.

Properties That Refer to Persistent Objects

This section describes how the Populate() method, by default, generates data for properties of the following form:

Property PropertyName as PersistentObject;

Where PersistentObject is a class that inherits from %PersistentOpens in a new tab.

For such properties:

  • If the referenced class inherits from %PopulateOpens in a new tab, the Populate() method performs a random sample of the extent of the referenced class and then randomly selects one value from that sample.

    Note that this means you must generate data for the referenced class first. Or create data for the class in any other way.

  • If the referenced class does not inherit from %PopulateOpens in a new tab, the Populate() method does not generate any values for the property.

For information on relationships, see the next section.

Relationship Properties

This section describes how the Populate() method, by default, generates data for properties of the following form:

Relationship PropertyName as PersistentObject;

Where PersistentObject is a class that inherits from %PersistentOpens in a new tab.

For such properties:

  • If the referenced class inherits from %PopulateOpens in a new tab:

    • If the cardinality of the relationship is one or parent, then the Populate() method performs a random sample of the extent of the referenced class and then randomly selects one value from that sample.

      Note that this means you must generate data for the referenced class first. Or create data for the class in any other way.

    • If the cardinality of the relationship is many or children, then the Populate() method ignores this property because the values for this property are not stored in the extent for this class.

  • If the referenced class does not inherit from %PopulateOpens in a new tab, the Populate() method does not generate any values for the property.

FeedbackOpens in a new tab