Tricky Problem Using Report Builder In Threads
Hello
I have a tricky problem which I need urgent help in fixing please. I am
using Report Builder 7.02, Delphi 6 and threads.
I have designed a report and saved it into a template. This report is
generated within seperate threads. Because of this, I have to do everything
dynamically. Initially, creating a report was not a problem, I just created
it using the main form of the application as the owner. I have now got a
problem because I want to incorporate a pipeline into the report. My
pipeline is very simple, just 1 field, I can add more later. Each thread
has its own pipeline. When I designed the report I used a report and
pipeline that were on my main form. Now I need to associate each new report
with its own pipeline. My pipeline on the main report is called
pipeMainReportData. My problem is that when I create a new pipeline, I
cannot call it pipeMainReportData if I create it with the main form as the
owner, because 2 pipelines are created with the same name by 2 different
threads, obviously I cannot have 2 components with the same name on the same
form.
I noticed that when you create a Report you have to give it a TComponent
object as the owner. So I tried creating a class
TThreadVar=CLASS(TComponent) a new instance of this class is created for
each thread.
When I create the report I specify a TThreadVar object as the owner. I then
specify the same object as the owner for the pipeline. When I then try to
access anything to do with the newly created report I get an access
violation.
Can anyone help? I dont want to have to go creating a seperate form for
every report, or go through the report finding all of the fields and
assigning them to the pipeline.
Cheers
Paul
I have a tricky problem which I need urgent help in fixing please. I am
using Report Builder 7.02, Delphi 6 and threads.
I have designed a report and saved it into a template. This report is
generated within seperate threads. Because of this, I have to do everything
dynamically. Initially, creating a report was not a problem, I just created
it using the main form of the application as the owner. I have now got a
problem because I want to incorporate a pipeline into the report. My
pipeline is very simple, just 1 field, I can add more later. Each thread
has its own pipeline. When I designed the report I used a report and
pipeline that were on my main form. Now I need to associate each new report
with its own pipeline. My pipeline on the main report is called
pipeMainReportData. My problem is that when I create a new pipeline, I
cannot call it pipeMainReportData if I create it with the main form as the
owner, because 2 pipelines are created with the same name by 2 different
threads, obviously I cannot have 2 components with the same name on the same
form.
I noticed that when you create a Report you have to give it a TComponent
object as the owner. So I tried creating a class
TThreadVar=CLASS(TComponent) a new instance of this class is created for
each thread.
When I create the report I specify a TThreadVar object as the owner. I then
specify the same object as the owner for the pipeline. When I then try to
access anything to do with the newly created report I get an access
violation.
Can anyone help? I dont want to have to go creating a seperate form for
every report, or go through the report finding all of the fields and
assigning them to the pipeline.
Cheers
Paul
This discussion has been closed.
Comments
builder server