%Library.PopulateUtils
Class %Library.PopulateUtils [ Not ProcedureBlock, System = 2 ]
For details on using this class, see Using the Populate Utility.
The %PopulateUtils class contains a number of utility methods used by the %Populate class.
Methods
ArrayElement
ClassMethod ArrayElement(ByRef array) As %String
Return a random array element.
ExtentValue
ClassMethod ExtentValue(cptr As %Integer, cext As %Integer) As %String
Return a random value from a concrete value extent.
BuildReferenceSample
ClassMethod BuildReferenceSample(class, sample, size = 500, selpct = 25)
Return an array of ids selected randomly from the Extent query of the class in the sample parameter. The array is of the form: sample=n sample(1)=id1,sample(2)=id2,...,sample(n)=idn Parameters: class - the class to retrieve samples from sample - the array of samples (returned) size - the maximum number of samples to retrieve selpct - the percentage of instances to be randomly selected. for example, 25 means approximately 25% of the instances will be selected (1 in 4).
BuildValueSetSQL
ClassMethod BuildValueSetSQL(cptr, cext, table, column, size = 500, verbose As %Integer = 0) As %Status [ ProcedureBlock = 1 ]
Populate a value set from a query
City
ClassMethod City() As %String
Return a random city name.
Company
ClassMethod Company() As %String
Return a random company name.
Currency
ClassMethod Currency(min As %Integer = 0, max As %Integer = 10000) As %Integer
Return a random currency value between min and max (if present).
Date
ClassMethod Date(min As %Date, max As %Integer) As %Date
Return a random date value in InterSystems IRIS $H
format.
CDate
ClassMethod CDate(format As %Integer = 1, min As %Date = 30000, max As %Date = 55000) As %String
Counter
ClassMethod Counter(counter As %String = "c", initial As %Integer = 1) As %String
FirstName
ClassMethod FirstName(gender As %String = "") As %String
Return a string containing a random first name.
gender is a optional string used to control the gender of the generated name: 1 is Male, 2 = Female, "" is either.
Float
ClassMethod Float(min As %Float = 0, max As %Float = 10000, scale As %Integer = 0) As %Integer [ ProcedureBlock = 1 ]
Return a random floating point value between min and max (if present).
Integer
ClassMethod Integer(min As %Integer = 0, max As %Integer = 1000000000) As %Integer [ ProcedureBlock = 1 ]
Return a random integer value between min and max (if present).
LastName
ClassMethod LastName() As %String
Return a string containing a random last name.
Mission
ClassMethod Mission() As %String
Returns a string containing a randomly generated corporate mission statement.
Name
ClassMethod Name(gender As %String = "") As %String
Return a string containing a random name as lastname,firstname.
gender is a optional string used to control the gender of the generated name: 1 is Male, 2 = Female, "" is either.
SSN
ClassMethod SSN() As %String [ CodeMode = expression ]
Return a random U.S. Social Security Number.
String
ClassMethod String(len As %Integer = 1) As %String
Return a string value of the form _ and whose length does not exceed len.
StringMin
ClassMethod StringMin(minlen As %Integer = 1, maxlen As %Integer = 1) As %String [ ProcedureBlock = 1 ]
Return a random string value whose length is at least minlen and not greater than maxlen.
Street
ClassMethod Street() As %String
Return a random street address.
Syllable
ClassMethod Syllable(maxlen As %Integer = 30) As %String
Return a string of random syllables and spaces. The algorithm uses several syllable 'lists'. First, a list is randomly chosen. Then a syllable from that list is chosen and added to the string. Then, if a random boolean is TRUE, a space is appended. Syllables are added to the string until the string length exceeds a random length less than or equal to the parameter maxlen.
PosixTime
ClassMethod PosixTime(min As %PosixTime = "", max As %PosixTime = "") As %PosixTime [ ProcedureBlock = 1 ]
Return a random %PosixTime value that is between the specified min and max %PosixTime values. If either min or max is not a valid %PosixTime value, then the default value is used instead. The default min value is -6919738016441081856 (1900-01-01 00:00:00) The default max value is the current timestamp value
TimeStamp
ClassMethod TimeStamp(min As %TimeStamp, max As %TimeStamp) As %String [ ProcedureBlock = 1 ]
Return a random TimeStamp value that is between the specified min and max timestamp values. The default min value is the default Date min date value with time = 0. The default max value is the default Date max date value with time = 86399 (23:59:59). If either min or max is not a valid %TimeStamp value, then the default value is used instead.
Title
ClassMethod Title() As %String
Return a random job title.
USPhone
ClassMethod USPhone() As %String [ CodeMode = expression ]
Return a random U.S. phone number.
USState
ClassMethod USState() As %String
Return a random U.S. state abbreviation.
USZip
ClassMethod USZip() As %String [ CodeMode = expression ]
Return a random U.S. Zone Improvement Plan (ZIP) code.
ValueList
ClassMethod ValueList(vallist) As %String
Return a random piece from a delimited list. The first character in the list is the delimiter.
VarString
ClassMethod VarString(maxlen As %Integer = 1) As %String
Return a random string value of random length up to maxlen characters.
Color
ClassMethod Color() As %String
Return a random color name (one of 5 possible values).
Product
ClassMethod Product() As %String
Return a random product name (one of 4 possible values).
Random
ClassMethod Random(n As %Integer) As %Integer
Return a random number from 0-n using a random number generator that is seeded by %Library.Populate.