Jump to content

Side effect bug on ReportBuilder 15 and UniGui

Darth Florus

Recommended Posts

Mr. Farshad:


There is a side effect bug when I use Report Builder 15 in combination with UniGui


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


Link to comment
Share on other sites

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:



l_titulo := UniMainModule.Aseguradora.IDAseguradora;



UniMainModule is Nil.


Inside "function UniMainModule" are some like this:



if UniApplication <> Nil then

  Result := <some code>


  Result := UniVCL(<some other 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.

Link to comment
Share on other sites

Mr. Farshad:


I understand!.




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.

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...