Question
Colin Parker · Mar 3, 2020

How to Set Data in a Property from a Routine

Hello,

I am wondering if it is possible to access properties of a class from within a routine that has been called. See the below example:

Class TestClass Extends %RegisteredObject
{

Property Data As %ListOfDataTypes;

Method Query(parameter As %String)

{

   d runTag^ExampleRoutine(parameter)

   q

}

}

 

And then I have a routine:

ExampleRoutine

runTag(parameter) 

  ;I want to add some information to the Data property in the class here.

  q

00
2 0 3 178
Log in or sign up to continue

You can use the $THIS special variable. For example:

runTag(parameter)
    set t = $THIS
    do t.Data.Insert("abc")
    w t.Data.GetAt(1)
    q

Thank you. That works perfectly.