Skip to main content

Caché Methods

The Person class also provides some built-in methods for your use. Methods are Basic subroutines that perform some action on objects. You can use the following methods:

  • New creates a new Person object in local memory.

  • OpenId loads a persistent Person object into local memory. OpenId can automatically lock.

  • %Save verifies the data in a Person object in local memory, and if the data verifies correctly, saves the data. A %Save of an object is automatically performed as a transaction.

To create new Person objects, you'll use New, set the data (using “dot syntax” that you'll see below), and %Save. For editing existing objects, you use OpenId, update the data (again using dot syntax), and %Save. To refer to the properties of a Person object, you use dot syntax (

Here's an example. Note that you can't try this example until you convert your globals (refer to the next page). The first line below opens an existing Person object whose id is 2. Then you can use per to refer to the properties of the person object without caring about how the data is stored. Set per to Nothing to destroy the local copy of the person object.

per = OpenId BasTutorial.Person(2)
println "Name: ", per.Name
println "Phone: ", per.Phone
println "DOB: ", DateConvert(per.DOB, vbToExternal)
per = Nothing
FeedbackOpens in a new tab