Clayton
25-Aug-2010, 11:47 PM
Hi,
I'm using a set of VRW subclasses wrote by me where I can set functions in dynamic preview windows of my reports. After running a report I'm having some problems with the error handler.
Debugging the issue I found the problem at RedirectErrorsToLocalHandler procedure in cVisualReport.Pkg: the iLocalErrorRedirectCount doesn't decrement back to its right value (1) when the report is closed. Consequently, the Error_Object_ID doesn't get back the value from phOldErrorObject. Debugging further, I found this is caused by the set psFunction statements called from my subclass.
Looking at "Procedure Set psFunction" code, the iLocalErrorRedirectCount is incremented (at beginning) by "Send RedirectErrorsToLocalHandler True" statement, and decremented (at end) by "Send RedirectErrorsToLocalHandler False" statement.
The code of "Procedure Set psFunction" calls the "FunctionIdByName" function, which has the same code to increment and decrement iLocalErrorRedirectCount by calling the "RedirectErrorsToLocalHandler" method (True at beginning and False at end). But I've finally found the problem: When the function name is found, the FunctionIdByName returns the function identifier but doesn't send "RedirectErrorsToLocalHandler False".
To fix the problem I changed the code at FunctionIdByName in cVisualReport.Pkg to:
If (Lowercase (sNthFunctionName) = sFunctionName) Begin
Send RedirectErrorsToLocalHandler False
Function_Return iFunction
End
Is this correct? Can I keep the code changed?
Thanks.
I'm using a set of VRW subclasses wrote by me where I can set functions in dynamic preview windows of my reports. After running a report I'm having some problems with the error handler.
Debugging the issue I found the problem at RedirectErrorsToLocalHandler procedure in cVisualReport.Pkg: the iLocalErrorRedirectCount doesn't decrement back to its right value (1) when the report is closed. Consequently, the Error_Object_ID doesn't get back the value from phOldErrorObject. Debugging further, I found this is caused by the set psFunction statements called from my subclass.
Looking at "Procedure Set psFunction" code, the iLocalErrorRedirectCount is incremented (at beginning) by "Send RedirectErrorsToLocalHandler True" statement, and decremented (at end) by "Send RedirectErrorsToLocalHandler False" statement.
The code of "Procedure Set psFunction" calls the "FunctionIdByName" function, which has the same code to increment and decrement iLocalErrorRedirectCount by calling the "RedirectErrorsToLocalHandler" method (True at beginning and False at end). But I've finally found the problem: When the function name is found, the FunctionIdByName returns the function identifier but doesn't send "RedirectErrorsToLocalHandler False".
To fix the problem I changed the code at FunctionIdByName in cVisualReport.Pkg to:
If (Lowercase (sNthFunctionName) = sFunctionName) Begin
Send RedirectErrorsToLocalHandler False
Function_Return iFunction
End
Is this correct? Can I keep the code changed?
Thanks.