Question
· Mar 17

How to use class property ot type %Persistent in non persistent class (page)

Is there a way to use a property of the type %Persistent class in a  %ZEN.Component.page class?
Example:

// Data class
Class PersistentClass Extends %Persistent
{
    Property Value As %String;
}
// Page class
Class ClassName Extends %ZEN.Component.page
{
  Property TestProperty As PersistentClass
}


The problem is that when using it the described in the example.
The property can be set in a Method like this:

Method DoStuff() As %Status  [ ZenMethod ]
{
    Set result = ##class(HBS.EnsUtil.CompanyFunctions).GetData(.aVariable) // aVariable is of type PersistentClass
    Set ..TestProperty = aVariable
    Quit result
}


But when reading the property in an other Method the content of it is not set:

Method ReadProperty() As %Status [ ZenMethod ]
{
    Write ..TestProperty.Value // the object has no content
    Quit $$$OK
}

 

Is it generally possible to work like this?
Or have I overlooked a special handling?

Product version: IRIS 2021.1
Discussion (3)2
Log in or sign up to continue