Home > Class Reference > ENSLIB namespace > %CPT.GlobalsToRoutine
Private  Storage   


Encode one or more globals as a routine - when the routine is run the globals are set

This class is hardwired to generate only a single routine - so don't use this with globals that are too large

Typical use :-

	 <P> Set gtr=##class(%CPT.GlobalsToRoutine(mytemprtnname) If '$IsObject(gtr) {Quit %objlasterror}
	 <P> Do gtr.BuildOne("^||%isc.cptix")
	 <P> Do gtr.BuildOne("^||%isc.cpttix")
	 <P> Set sc=gtr.SaveRoutine() If $$$ISERR(sc) {Quit sc}


Parameters Properties Methods Queries Indices ForeignKeys Triggers


%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OnNew %OriginalNamespace
%PackageName %RemoveFromSaveSet %SerializeObject %SetModified


• method %OnNew(TargetRoutineName As %String) as %Status
This callback method is invoked by the %New method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.