Written by

Question Colin Parker · Mar 3, 2020

How to Set Data in a Property from a Routine

Go to the original post@Colin Parker

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

Comments

Igor Titarenko · Mar 3, 2020

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

0
Colin Parker  Mar 3, 2020 to Igor Titarenko

Thank you. That works perfectly.

0