Specifying the POPSPEC Parameter via an SQL Table
Specifying the POPSPEC Parameter via an SQL Table
For POPSPEC, rather than specifying a method that returns a random value, you can specify an SQL table name and an SQL column name to use. If you do so, then the Populate() method constructs a dynamic query to return the distinct column values from that column of that table. For this variation of POPSPEC, use the following syntax:
POPSPEC=":MaxNo:KeySpecMethod:SampleCount:Schema_Table:ColumnName"
Where:
-
MaxNo and KeySpecMethod are optional and apply only to collection properties (see earlier the subsections on lists and arrays).
-
SampleCount is the number of distinct values to retrieve from the given column, to use as a starting point. If this is larger than the number of existing distinct values in that column, then all values are possibly used.
-
Schema_Table is the name of the table.
-
ColumnName is the name of the column.
For example:
Property P1 As %String(POPSPEC=":::100:Wasabi_Data.Outlet:Phone");
In this example, the property P1 receives a random value from a list of 100 phone numbers retrieved from the Wasabi_Data.Outlet table.