Skip to main content

Specifying the POPSPEC Parameter for Non-Collection Properties

Specifying the POPSPEC Parameter for Non-Collection Properties

For a literal property that is not a collection, use one of the following variations:

  • POPSPEC="MethodName()" — In this case, Populate() invokes the class method MethodName*( of the %PopulateUtilsOpens in a new tab class.

  • POPSPEC=".MethodName()" — In this case, Populate() invokes the instance method MethodName() of the instance that is being generated.

  • POPSPEC="##class(ClassName).MethodName()" — In this case, Populate() invokes the class method MethodName() of the ClassName class.

For example:

Property HomeCity As %String(POPSPEC = "City()");

If you need to pass a string value as an argument to the given method, double the starting and closing quotation marks around that string. For example:

Property PName As %String(POPSPEC = "Name(""F"")");

Also, you can append a string to the value returned by the specified method. For example:

Property JrName As %String(POPSPEC = "Name()_"" jr."" ");

Notice that it is necessary to double the starting and closing quotation marks around that string. It is not possible to prepend a string, because the POPSPEC is assumed to start with a method.

Also see Specifying the POPSPEC Parameter via an SQL Table for a different approach.

FeedbackOpens in a new tab