Darth Florus Posted July 30, 2013 Posted July 30, 2013 Mr. Farshad: There is a side effect bug when I use Report Builder 15 in combination with UniGui 0.93.0.996. In ReportBuilder we have customized some methods to standarize headers, footers and so on our reports. Until the Report Builder 14.4 there are work wery well. But when we upgrade to RB 15 a bug heads up!. The problems is: The functions UniMainModule and UniApplication point on Nil, only when I execute procedures inside a RB 15 execution of a report. I know that these obviusly is a problem of RB 15, but why the functions UniMainModule and UniApplication point to Null? Its a shame that I can see the hidden code of function UniApplication to peek the probable reason of it. I need of You a advise. What I can do to debug and find the bug considerating I have not the source of UniGui to track and find it? You need a test project with RB 15 components supplied? What I can do? Best Regards Oscar Flor Sebaot Quote
Administrators Farshad Mohajeri Posted July 30, 2013 Administrators Posted July 30, 2013 The functions UniMainModule and UniApplication point on Nil Where do you call above functions? Quote
Darth Florus Posted July 31, 2013 Author Posted July 31, 2013 Mr. Farshad: I call these functions inside a custom method of Report Builder. Excactly into the "OnInitializeParameters" from main report. I call a custom function named "InicializarReporteParametros()". Inside I need the current customer ID. This is a custom property of MainModule called "property Aseguradora : TAseguradora". But when I execute the next: <code> l_titulo := UniMainModule.Aseguradora.IDAseguradora; </code> UniMainModule is Nil. Inside "function UniMainModule" are some like this: <code> if UniApplication <> Nil then Result := <some code> else Result := UniVCL(<some other code>) </code> then UniVCL (whatrever) points to nil because is not a VCL application is Web, but UniApplication point to Nil too, there is the problem. I want to know wath happend on function UniApplication but is hidden to me. Quote
Administrators Farshad Mohajeri Posted July 31, 2013 Administrators Posted July 31, 2013 UniApplication is valid only when called inside a uniGUI event such as button click. Program flow: UniApplication is garbage (--uniGUI event starts--) --> UniApplication is valid (--uniGUI event ends--) UniApplication is garbage Quote
Darth Florus Posted August 2, 2013 Author Posted August 2, 2013 Mr. Farshad: I understand!. Facts: 1) The ImprimirReporte (print report) method (thats execute "ReportBuilder.Print", that inside call custom functions) of UniMainModule is called inside a TUniButton.OnClick event. 2) With the same version of UniGui but previous versión of ReportBuilder works. That I say is a side effect bug. Is like the ReportBuilder execute his work inside a protected trhead that insolate it from "public UniGui variables", even if I put the units in the uses clause. To solve this problem (workarround called in spanish a "Banana"; a not well considerated code), I will create a parallel unisession collection and put inside it all my "public" properties hashed by UniSession.Session variable to identify the collection item and put the call of ReportBuilder.Print inside a CryticalSection (serializate calls) to set a public variable with the session id of the caller to identify it inside the custom Report Builder functions, because all access to "UniGui public variables" is not possible. Personally I don't recomend people to use ReportBuilder with UniGui because RB have so much singularity thath slow down developer work. But is a fact that RB have a advanced layout manager that make complex reports (like sales documents, contracts and statisticals analisis) to be possible without Delphi hard programing. Very Thanks for you time to try to solve this bug. Quote
Darth Florus Posted August 13, 2013 Author Posted August 13, 2013 Topic Update!!! Mr. Farshad: I made that I was saying here. I use a paralled UniMainModule object list in the UniServerModule. When a Session inits (MainModule.Create) I add it to the SessionList and the index is copied to my MainModule property Index. When sessión is gone (MainModule.Destroy) I find the index on the SessionList and destroy it. All this operations is maded inside a CriticalSection. Now I can use the new version of ReportBuilder! All now work very well!. Best Regards Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.