OnRecordPositionChange Behavior in RB7
In RB6, TppDBPipeline.OnRecordPositionChange does not fire when there
are no records. In RB7, it does. TppDBPipeline.SkipWhenNoRecords is
True in both cases.
Was this an intentional design change? I can't find anything about it
Release.doc, RBuilder.hlp, the datapipelines newsgroup, or the general
newsgroup.
Thanks
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
are no records. In RB7, it does. TppDBPipeline.SkipWhenNoRecords is
True in both cases.
Was this an intentional design change? I can't find anything about it
Release.doc, RBuilder.hlp, the datapipelines newsgroup, or the general
newsgroup.
Thanks
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
This discussion has been closed.
Comments
I meant to say that we're using Delphi 6, RB 6.03 & RB 7.03. Customers
on the current version of our product have RB7 reports, customers on
earlier versions have RB6 reports.
Thanks
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
ppReport.pas:TppReport.StartOfMainReport:
1647: {required for linked DataPipelines to ensure DataPipeline.State
is accurate}
1648: if (DataPipeline <> nil) and (DataPipeline.Active) then
1649: begin
1650: DataPipeline.State := [];
1651: DataPipeline.First;
1652: end;
Before line 1650 executes, DataPipeline.State = [ppdaNoRecords]. After
1650 executes, of course DataPipeline.State = []. Then,
DataPipeline.First is called:
ppDB.pas:TppDataPipeline.First:
2047: if (ppdaNoRecords in FState) then Exit;
When FState = [ppdaNoRecords], then TppDataPipeline.First should exit
without doing much. However, since FState was reset to [], this
doesn't happen.
Here's the relevant code from 6.03:
1551: {required for linked DataPipelines to ensure DataPipeline.State
is accurate}
1552: if (DataPipeline <> nil) then
1553: DataPipeline.First;
Note that 6.03 doesn't clear DataPipeline.State.
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
This behavior is the result of a bug fix for ReportBuilder 7. The fact that
this event fires when the pipeline is empty should not however effect the
generation of your reports unless you are processing some information inside
this event in which case you will need to take this new behavior into
account. What exactly are you doing inside this event? Perhaps I can help
you find a different way to accomplish the same task.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Well, considering that the event is "On Record Position Change", we
*assume* that the dataset has valid data in it. Since the dataset is
empty, we're getting various errors.
Considering my last post, TppReport.StartOfMainReport is now clearing
ppdaNoRecords from FState. If this is a bug fix, it looks more like a
hack. ppdaNoRecords is a valid state when the dataset is empty.
Whatever bug was fixed, there should be a way to fix it without
removing ppdaNoRecords from State. I'd say that calling a "Record
Position Change" event on an empty datset seems to be a bug itself.
We have a hack of our own. We can add:
if TppDBPipeline(Sender).DataSource.DataSet.RecordCount = 0 then Exit;
at the top of every OnRecordPositionChange event. However, we have 150
reports built with RBuilder. I don't consider this a reasonable
solution.
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
I realize you are frustrated with the changes that have been made with the
functionality of ReportBuilder and I apologize. However this fix was made
over 4 years ago due to the fact that the pipeline state was not being
properly reset in a master/detail report when the data was altered. The
change was made long enough ago without complaint from our customers for us
to declare that this is simply the way ReportBuilder works now. If I were
to change this behavior again, I could potentially break thousands of other
reports that have been created with the knowledge that the
OnRecordPositionChange event will fire regardless the amount of data present
in the dataset.
I would still like to know how you are using the OnRecordPositionChange
event and perhaps see an example of the problem you are experiencing. This
way I will be able to see what exactly you are trying to accomplish and I
may be able to either make a change to our source or provide a suggestion
for yours to make the transition from RB6 to RB7 less time consuming. The
purpose of these newsgroups is to provide friendly help and incite for those
having issues with ReportBuilder, not to criticize our world renowned
support or bug fixes. I feel the suggestions above will be a good step
towards a solution to the problem you are experiencing.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
RB7 was released on August 25, 2002, according to
http://www.digital-metaphors.com/Subpages/Support/News/News.html. This
"fix" is not in RB 6.03. From my standpoint, it was certainly not over
four years ago.
The pipeline state is now ALWAYS reset, even if the data is not
altered. IMHO, this bug could have been fixed without removing
ppdaNoRecords from State. By doing so, you have introduced a new bug,
because the pipeline does not have records and therefore State *should*
contain ppdaNoRecords.
I would say any code that expects OnRecordPositionChange to fire when
no records are present needs more attention than my code does.
I have attached a text file with five examples. In each of these
examples, we are determining if particular columns (fields) have
changed values since the previous row and taking action if the data did
change. Sometimes we're only looking at a single column. Other times
we're looking at a combination of columns.
---------------------------
Debugger Exception Notification
---------------------------
Project ReportTester.exe raised exception class EVariantTypeCastError
with message 'Could not convert variant of type (Null) into type
(Double)'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
This exception occurs on the following line because .Value returns a
NULL since the dataset (pipeline) contains no data:
if LastDate <> Trunc(plApptByRs.FieldObjects['PA_Start'].Value) then
But converting nothing (NULL) into something isn't the problem. The
problem is that we EXPECT there to be data to evaluate in
OnRecordPositionChange, and now there isn't. If there is no data,
there's no point in our code executing.
You could fix the bug so that TppDataPipeline.State contains
ppdaNoRecords when the dataset has no records.
Any suggestion will require us to modify our reports, rebuild them, and
redistribute them. Adding the hack
if TppDBPipeline(Sender).DataSource.DataSet.RecordCount = 0 then Exit;
at the top of each OnRecordPositionChange event in our reports is
simple. It restores our reports to RB6 functionality without making
major logic changes. I can't imagine a change to our source that is
less time consuming. I've spent more time in this newsgroup than the
change would take to make. It's the redeploying the new reports
that'll take a while.
Denying that this is a bug is not helpful. Yes, I understand that
another bug was fixed. But a new bug was created in the process. Is
there a legitimate reason that TppDataPipeline.State should NOT contain
ppdaNoRecords when the dataset has no records?
We've used RB for six years. This is the first time in *four* years
that we've needed support. RB is a great product. I vote for it every
year in the various Delphi awards.
If I can't voice criticism of the support I received, I can't expect it
to improve. Thanks for informing me that you're not interested in
improving.
I have the best solution I can get. Even if the bug is fixed, I still
have to rebuild and redeploy 150 reports to 150 customers.
I spent the time and energy to find the cause of a bug in RB7, thinking
that it might benefit you or other RB customers.
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
I forgot the attachment. My apologies. I hate it when I do that.
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
Out of curiousity, which pipeline state? The master pipeline or the
detail pipeline?
--
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
MedEvolve, Inc
http://www.medevolve.com
For future reference we prefer you send all attachments to us by email.
Thank you for the example and feedback. If possible, I would like to
continue this conversation through email. Please send the attachement as
well as any other helpful information to (nico AT digital-metaphors DOT
com).
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com