Board index » delphi » preventing repeat records

preventing repeat records

Hi there,
    we have an interesting problem. I want to prevent certain records in a
dataset (TQuery) from showing up in a report. I also do not  want them to be
included in any sum calculations. Adding a field in the database to
distinguish these records is not really an option right now, so I'm trying a
coding solution. Do you guys have any ideas?  I did attempt putting a
conditional Next in the AfterScroll event of the TQuery object, but it
seemed to corrupt/mixup the dataset pointers because I was getting
unexpected results (wrong record skipped and another record repeated). My
theory was probably flawed because I was causing event recursion. Anyhow, do
you guys know how to do this? Any advice would be appreciated. Thank you,

    Steve Anderson
    steve.ander...@homemail.com

 

Re:preventing repeat records


Have you considered using a filter, (either the Filter property or the
OnFilterRecord event)? You can use the Filtered property to turn the
filtering on and off.

Quote
"Steve Anderson" <steve.ander...@homemail.com> wrote in message

news:8b6av6$7i2$1@mur2.odyssey.on.ca...
Quote
> Hi there,
>     we have an interesting problem. I want to prevent certain records in a
> dataset (TQuery) from showing up in a report. I also do not  want them to
be
> included in any sum calculations. Adding a field in the database to
> distinguish these records is not really an option right now, so I'm trying
a
> coding solution. Do you guys have any ideas?  I did attempt putting a
> conditional Next in the AfterScroll event of the TQuery object, but it
> seemed to corrupt/mixup the dataset pointers because I was getting
> unexpected results (wrong record skipped and another record repeated). My
> theory was probably flawed because I was causing event recursion. Anyhow,
do
> you guys know how to do this? Any advice would be appreciated. Thank you,

>     Steve Anderson
>     steve.ander...@homemail.com

Re:preventing repeat records


Thanks for the tip, worked great, no more wierd pointer corruptions.

    Steve

Quote
Bruce Roberts <no.junk.please....@attcanada.net> wrote in message

news:hUCB4.14753$Xk2.61855@tor-nn1.netcom.ca...
Quote
> Have you considered using a filter, (either the Filter property or the
> OnFilterRecord event)? You can use the Filtered property to turn the
> filtering on and off.

> "Steve Anderson" <steve.ander...@homemail.com> wrote in message
> news:8b6av6$7i2$1@mur2.odyssey.on.ca...
> > Hi there,
> >     we have an interesting problem. I want to prevent certain records in
a
> > dataset (TQuery) from showing up in a report. I also do not  want them
to
> be
> > included in any sum calculations. Adding a field in the database to
> > distinguish these records is not really an option right now, so I'm
trying
> a
> > coding solution. Do you guys have any ideas?  I did attempt putting a
> > conditional Next in the AfterScroll event of the TQuery object, but it
> > seemed to corrupt/mixup the dataset pointers because I was getting
> > unexpected results (wrong record skipped and another record repeated).
My
> > theory was probably flawed because I was causing event recursion.
Anyhow,
> do
> > you guys know how to do this? Any advice would be appreciated. Thank
you,

> >     Steve Anderson
> >     steve.ander...@homemail.com

Other Threads