Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Using</strong> <strong>Objects</strong> with <strong>Caché</strong> ObjectScript<br />
Do oref.PropertyName.SetObjectAt(ElementOid,key)<br />
where oref is the OREF of the specific object to associate the data with, PropertyName is the<br />
name of the list property, ElementOid is the OID of the new element, and key is the key<br />
associated with the new element. For example, to add a dog accessed by name to an array of<br />
pets in a Person object, use the following code:<br />
Do per.Pets.SetObjectAt(DogOid,"Rover")<br />
where per is the OREF of the Person object and “Rover” is the key used to access the dog<br />
with the OIDDogOid.<br />
10.4.4.4 Modifying Properties of <strong>Objects</strong> in Arrays<br />
Once an object has been added to an array, you can modify its properties as follows:<br />
Set oref.PropertyName.GetAt(key).ArrayPropertyName = data<br />
where oref is the OREF of the object containing the list, PropertyName is the name of the<br />
array property, key identifies the object to update, ArrayPropertyName is the property to<br />
update, and data is the actual data associated with the property. For example, to set the type<br />
of Vaccination given to a patient on 02/23/98, use the following code:<br />
Set pat.Vaccination.GetAt("02/23/98").Type = "Polio"<br />
where pat is the OREF of the Patient object given a Polio vaccination on 2/23/98.<br />
10.4.5 Modifying Stream Properties<br />
To populate a stream property, use the following syntax:<br />
Do oref.PropertyName.Write(data)<br />
where oref is the OREF of the object containing the stream, PropertyName is the name of<br />
the stream property, Write is a method of the Stream class, and data is the actual data associated<br />
with the property. For example, to add a paragraph to a Note property of a Visit object,<br />
use the following code:<br />
Do visit.Note.Write(note)<br />
where visit is the OREF of the Visit object and note is the data entered by the doctor at the<br />
time of the visit.<br />
80 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>