>>>Hi,
>>>
>>>Is it possible to use a class method as the expression for a report field?
>>>I guess I'm really just asking how/whether one can instantiate a class object in the report?
>>>TIA,
>>>Viv
>>
>>Sorry if this is already answered. You need to instantiate your class object in the program/form calling the report, then you would be able to use its methods.
>>
>>Alternatively you can create a public variable in Report's DE Init (or OpenTables ?) method and release it in Report's DE destroy. But if you have control of the calling form/program, I believe the first is the better choice.
>
>Not sure about that. In some ways I like the DE solution better in that it works at design time without my having to remember to instantiate the object in question.
>Regards,
>Viv
That's true as well. However, if you already have the form's instance, you may try to reuse it. So, you would create it conditionally, e.g. in Report's DE
if vartype(myObject) = 'U'
public myObject ...
endif
In the calling form
local myObject (may be private)
myObject = thisform.myObject
report form ...
myObject = null
If it's not broken, fix it until it is.
My Blog