Executes a series of statements on a single object.
statement requires the following arguments:
||An expression that resolves to an object reference. object may be a function call that returns an object reference, or a subscripted variable that contains an object reference.
||One or more statements to be executed on the object.
statement allows you to perform a series of statements on a specified object without requalifying the name of the object. For example, to change a number of different properties on a single object, place the property assignment statements within the With
block code, referring to the object once instead of referring to it with each property assignment.
object reference is evaluated upon entering the With
block, and is not reevaluated within the With
block. Therefore, you cannot use a single With
statement to affect a number of different objects. Changing the object
variable value within the With
block is permitted, but does not change which object is used for anonymous references within the With
While property manipulation is an important aspect of With
functionality, it is not the only use. Any legal code can be used within a With
You can nest With
statements by placing one With
block within another. However, because members of outer With
blocks are masked within the inner With
blocks, you must provide a fully qualified object reference in an inner With
block to any member of an object in an outer With
statement cannot be used to enter the body of a With
block, or into a nested inner With
block. You can, however, issue a Goto
within a With
block to a label within that block, or to an outer With
block label, or to a label outside the With
The following example illustrates use of the With
statement to assign values to several properties of the same object.
.City = "Cambridge"
.State = "MA"
.Street = "One Memorial Drive"
© 1997-2019 InterSystems Corporation, Cambridge, MA