 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Russell Weetch Guest
|
Posted: Thu Aug 14, 2003 9:36 am Post subject: TAgregate Expressions |
|
|
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
|
Posted: Thu Aug 14, 2003 11:12 am Post subject: Re: TAgregate Expressions |
|
|
"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
|
Posted: Thu Aug 14, 2003 12:40 pm Post subject: Re: TAgregate Expressions |
|
|
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
|
Posted: Thu Aug 14, 2003 2:22 pm Post subject: Re: TAgregate Expressions |
|
|
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 |
|
 |
|
|
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
|
|