Subject | Re: Filter Problems |
---|---|
Author | Bill Gage |
Post date | 2005-02-11T16:40:51Z |
I didn't say it using HAVING didn't work for me, I know it will. I
was just hoping I didn't have to implement it that way, you know
Object Oriented programming. ;-)
What I find odd is that some of the fields DO work with the filter.
I guess I am curious how the filtering system actually works.
Is it just appending the filtering information on the WHERE clause
and then requerying the database?
If this is the case, then what makes me raise additional questions
is that when I use an in memory dataset, I can filter the
information and then see only my filtered records, remove the filter
and see all of the records.
I understand that this component may not be managed the same way an
in memory dataset is managed. Just as a test I am going to do the
unthinkable and try doing the same thing connecting with the BDE and
IBExpress.
I will post my results here.
Bill
--- In IBObjects@yahoogroups.com, "Bob Zirbel" <bobz22001@y...>
wrote:
was just hoping I didn't have to implement it that way, you know
Object Oriented programming. ;-)
What I find odd is that some of the fields DO work with the filter.
I guess I am curious how the filtering system actually works.
Is it just appending the filtering information on the WHERE clause
and then requerying the database?
If this is the case, then what makes me raise additional questions
is that when I use an in memory dataset, I can filter the
information and then see only my filtered records, remove the filter
and see all of the records.
I understand that this component may not be managed the same way an
in memory dataset is managed. Just as a test I am going to do the
unthinkable and try doing the same thing connecting with the BDE and
IBExpress.
I will post my results here.
Bill
--- In IBObjects@yahoogroups.com, "Bob Zirbel" <bobz22001@y...>
wrote:
>it
> Bill
>
> HAVING seems to do what you want in my test example. Why doesn't
> work for you?similar
>
> Regards
>
> Bob
>
>
> --- In IBObjects@yahoogroups.com, "Bill Gage" <wcgage@y...> wrote:
> >
> > Let me expound on how this is useful and what it would be
> toof
> > in SQL
> >
> > it would be like writing the following
> >
> > SELECT Count(*), PRODUCT_CODE, SUM(BALANCE) BAL FROM ACCOUNTS
> GROUP
> > BY PRODUCT_CODE HAVING Count(*) > 10
> >
> > How this is useful is that you really only want to see the sum
> > the balance for products that have a count over 10.records
> >
> > Now I COULD go in and dynamically rewrite the SQL statement.
> > However this is a bit inefficient when I can query all of the
> > records and then just filter the results on the screen.
> >
> > Now if applying a filter on TIBOQuery causes the dataset to be
> > requiried then I may as well just dynamically write the SQL
> > statement.
> >
> > But I would hope that the Filter would work to reduce the
> Iwrote:
> > am getting back.
> >
> > Bill
> >
> >
> > --- In IBObjects@yahoogroups.com, "Bill Gage" <wcgage@y...>
> > ><bobz22001@y...>
> > > You'll note the Group by so there IS more than one record.
> > >
> > >
> > > --- In IBObjects@yahoogroups.com, "Bob Zirbel"
> > > wrote:thing
> > > >
> > > > Bill
> > > >
> > > > I'm not sure what you are trying to do is valid.
> > > >
> > > > Your query returns only one record anyway because of Count
> (and
> > > SUM)
> > > > so it doesn't make sense to apply a filter.
> > > > All you can do is restrict the number of records included in
> the
> > > > Count by filtering on an actual database field like
> Product_Code.
> > > >
> > > > If you explain what you are trying to do, I may be able to
> help
> > > you
> > > > with the SQL.
> > > >
> > > > Regards
> > > >
> > > > Bob
> > > >
> > > >
> > > > --- In IBObjects@yahoogroups.com, "Bill Gage" <wcgage@y...>
> > wrote:
> > > > >
> > > > > v 4.2G
> > > > > using TIBOQuery and TIBODatabase
> > > > >
> > > > > I have been having wierd results trying to use the Filter
> > > property
> > > > > of IBObjects.
> > > > >
> > > > > I have a simple query that is like the following
> > > > >
> > > > > SELECT Count(*), PRODUCT_CODE, SUM(BALANCE) BAL FROM
> ACCOUNTS
> > > > GROUP
> > > > > BY PRODUCT_CODE
> > > > >
> > > > > it runs fine
> > > > >
> > > > > I try to set the filter to the following
> > > > > COUNT > 10
> > > > >
> > > > > I get the following error
> > > > > SQL error code = -104
> > > > > Token unknown - line 2, char 12
> > > > > >
> > > > >
> > > > > I even tried the above on other queries doing the same
> > and
> > > > > against different databases and still get the same error.
> > > > >
> > > > > I tried changing the filter to
> > > > >
> > > > > COUNT = 10
> > > > >
> > > > > and I get...
> > > > > SQL error code = -104
> > > > > Token unknown - line 2, char 12
> > > > > =
> > > > >
> > > > > Then I have tried filtering off other fields
> > > > > PRODUCT_CODE = 'L11'
> > > > > this worked
> > > > >
> > > > > I tried another field
> > > > > BAL > 1000
> > > > >
> > > > > and I get the error
> > > > > SQL error code = -206
> > > > > column unknown
> > > > > BAL
> > > > >
> > > > > Is there some sort of setting I need to make to get the
> filter
> > > to
> > > > > function consistently?
> > > > >
> > > > > Or is there a bug with the filtering in version 4.2?
> > > > >
> > > > > Bill