BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TAgregate Expressions

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Russell Weetch
Guest





PostPosted: Thu Aug 14, 2003 9:36 am    Post subject: TAgregate Expressions Reply with quote



Does anyone know of a document/site that has examples of aggregate
expressions?

Can I do an if? sort of

if field1 in '1,2,3' then sum(field2)


thanks

Russell


Back to top
Dave Rowntree
Guest





PostPosted: Thu Aug 14, 2003 11:12 am    Post subject: Re: TAgregate Expressions Reply with quote



"Russell Weetch" <russell (AT) systematicmarketing (DOT) com> wrote:

Quote:
Does anyone know of a document/site that has examples of aggregate
expressions?

Can I do an if? sort of

if field1 in '1,2,3' then sum(field2)

No. TAggregate/TAggregateField allows you to perform summary
operations on a/some fields(s) accross a group of records. The summary
operators that can be used are well documented in help. It also
provides examples of what is possible and what is not. Have a look at
the TAggregate.IndexName and GroupingLevel for information on how to
apply an aggregate to a particular set of records.
--
Dave Rowntree

Back to top
Russell Weetch
Guest





PostPosted: Thu Aug 14, 2003 12:40 pm    Post subject: Re: TAgregate Expressions Reply with quote



Thanks Dave

pretty much as I though, just wanted to make sure I wasn't missing anything.

One question, if I may.

When you have IndexName and GroupingLevel set, I can only get the the value
of the aggregate for the first grouping:

table OrderTyp, Qty
index "otIdx" OrderTyp grouping level = 1
aggregate Sum(Qty), groupinglevel = 1, indexname=otIdx

data:
ordertye qty
1 3
1 2
2 1
2 6

so
for OrderTyp = 1 the result is 5
for OrderTyp = 2 the result is 7

However, when I access cds.Aggregates.Items[0] I can only get the result for
OrderTyp = 1.

Any help greatly appreciated.



"Dave Rowntree" <daver (AT) spam_offbrookswood (DOT) co.uk> wrote

Quote:
"Russell Weetch" <russell (AT) systematicmarketing (DOT) com> wrote:

Does anyone know of a document/site that has examples of aggregate
expressions?

Can I do an if? sort of

if field1 in '1,2,3' then sum(field2)

No. TAggregate/TAggregateField allows you to perform summary
operations on a/some fields(s) accross a group of records. The summary
operators that can be used are well documented in help. It also
provides examples of what is possible and what is not. Have a look at
the TAggregate.IndexName and GroupingLevel for information on how to
apply an aggregate to a particular set of records.
--
Dave Rowntree



Back to top
Russell Weetch
Guest





PostPosted: Thu Aug 14, 2003 2:22 pm    Post subject: Re: TAgregate Expressions Reply with quote

Thanks again Dave.

Ok, I see. Pity, it would have made it really easy if the value was indexed.

best

Russell


"Dave Rowntree" <daver (AT) spam_offbrookswood (DOT) co.uk> wrote

Quote:
"Russell Weetch" <russell (AT) systematicmarketing (DOT) com> wrote:
When you have IndexName and GroupingLevel set, I can only get the the
value
of the aggregate for the first grouping:

table OrderTyp, Qty
index "otIdx" OrderTyp grouping level = 1
aggregate Sum(Qty), groupinglevel = 1, indexname=otIdx

data:
ordertye qty
1 3
1 2
2 1
2 6

so
for OrderTyp = 1 the result is 5
for OrderTyp = 2 the result is 7

However, when I access cds.Aggregates.Items[0] I can only get the result
for
OrderTyp = 1.

The Aggregate shows the value for the group the CDS currently selected
record belongs to. To see the value of OrderTyp 2, scroll onto a
record that belongs to that group.

--
Dave Rowntree



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.