PC Review


Reply
Thread Tools Rate Thread

Aggregate Expression Returning NULL

 
 
=?Utf-8?B?SmF5IFBvbmR5?=
Guest
Posts: n/a
 
      22nd Feb 2005
I have a strongly typed dataset with 3 related tables:

PayrollChecks (Parent)
PayrollCredits (Child of PayrollChecks 1 to many)
PayrollDeductions (Child of PayrollChecks 1 to many)

I can loop through the PayrollChecks table and using the relationships print
out the Credits and Deductions for each check so the DATA IN THE TABLES IS
CORRECT and there are NO NULLS.

Adding a Credits aggregate sum field to the PayrollChecks table returns the
correct data.

Adding a Deductions aggregate sum field to the PayrollChecks table always
returns NULL - there are NO NULL records in the child table.

The PayrollChecks table has a multi-part primary key defined - the Child
tables do NOT have primary keys defined as there are no unique field
combinations. The child tables do have the same fields as the parents primary
key.

I have crawled all over this thing deleting and re-adding relationships,
changing the fetch order, renaming relationships and have come up ZIP!

Anyone seen something like this or know where else I might look?

--------------------------
Thanks - Jay Pondy
--------------------------
We see the world, not as it is, but as we are.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmF5IFBvbmR5?=
Guest
Posts: n/a
 
      22nd Feb 2005
After 4 hours and much knashing of teeth I have uncovered a work around for
this problem.

The reason the aggregate sum on the PayrollCredits was working is that it
had a field that referenced the Parent using an expression of Parent.PayType.

When I added the same field to the PayrollDeductions table the Deductions
Aggregate started working.

This is certainly something that Microsoft should look into - without an
expression field referencing back to the Parent the Aggreate functions will
not work on child tables without Primary Keys.

"Jay Pondy" wrote:

> I have a strongly typed dataset with 3 related tables:
>
> PayrollChecks (Parent)
> PayrollCredits (Child of PayrollChecks 1 to many)
> PayrollDeductions (Child of PayrollChecks 1 to many)
>
> I can loop through the PayrollChecks table and using the relationships print
> out the Credits and Deductions for each check so the DATA IN THE TABLES IS
> CORRECT and there are NO NULLS.
>
> Adding a Credits aggregate sum field to the PayrollChecks table returns the
> correct data.
>
> Adding a Deductions aggregate sum field to the PayrollChecks table always
> returns NULL - there are NO NULL records in the child table.
>
> The PayrollChecks table has a multi-part primary key defined - the Child
> tables do NOT have primary keys defined as there are no unique field
> combinations. The child tables do have the same fields as the parents primary
> key.
>
> I have crawled all over this thing deleting and re-adding relationships,
> changing the fetch order, renaming relationships and have come up ZIP!
>
> Anyone seen something like this or know where else I might look?
>
> --------------------------
> Thanks - Jay Pondy
> --------------------------
> We see the world, not as it is, but as we are.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't use an aggregate function in an expression? wannabe geek Microsoft Access Queries 4 17th Oct 2009 02:43 PM
Cannot have aggregate function in expression Love Buzz Microsoft Access Queries 2 21st Jul 2008 05:41 PM
Aggregate returning 4 "non-aggregate" records. =?Utf-8?B?Qm9iIEJhcm5lcw==?= Microsoft Access Queries 2 23rd Oct 2007 08:07 PM
Aggregate Expression error. Roger Twomey Microsoft Access Queries 3 17th Aug 2004 08:30 PM
Expression Aggregate Question Woody Splawn Microsoft ADO .NET 0 8th Jul 2004 12:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:55 AM.