PC Review


Reply
Thread Tools Rate Thread

DataTable Compute Method

 
 
=?Utf-8?B?QW5kcmVpd2lk?=
Guest
Posts: n/a
 
      4th Nov 2005
Hi!

There are 3 DaTables in my DataSet, which 1 is the Master and 2 are
Children. I've set the relations and everything is working fine. But when I
try to use the Compute method I receive a strange error and I can't find the
solution.

dtsMovES.Tables("MovES").Compute("COUNT(Child(MovES_To_MovESItens).CodMovESItens)", String.Empty)

ERROR:
An unhandled exception of type 'System.Data.EvaluateException' occured in
system.windows.forms.dll
Additional information: Is not possible to evaluate. Expression
'Count(child([MovES_To_MovESItens]).[CodMovESItens])' is not aggregate.

I'm sure about the relations/tables/fields' names.
Please I need another sorte of eyes to look at it.

Thanks!

 
Reply With Quote
 
 
 
 
Vasco Veiga [MS]
Guest
Posts: n/a
 
      8th Nov 2005
If i understand correctly, you want to compute the nb of "itens" for a given
MovEs record.

The easiest way is to add an expression column (ex: ItensCount) on the MovEs
table with the expression "COUNT(Child(MovES_To_MovESItens).CodMovESItens)".
This will give you the nb of itens for each MovEs record.
dtsMovEs.Columns.Add( "ItensCount" ).Expression = "

Then you can also do
dtsMovES.Tables("MovES").Compute("SUM(ItensCount)", String.Empty)
which will return you the total nb of Itens for the MovEs records.

You cannot use DataTable.Compute because it does not allow you to aggregate
over non local columns.

--
--VV [MS]

"Andreiwid" <(E-Mail Removed)> wrote in message
news1E8447C-1DE2-4094-9683-(E-Mail Removed)...
> Hi!
>
> There are 3 DaTables in my DataSet, which 1 is the Master and 2 are
> Children. I've set the relations and everything is working fine. But when
> I
> try to use the Compute method I receive a strange error and I can't find
> the
> solution.
>
> dtsMovES.Tables("MovES").Compute("COUNT(Child(MovES_To_MovESItens).CodMovESItens)",
> String.Empty)
>
> ERROR:
> An unhandled exception of type 'System.Data.EvaluateException' occured in
> system.windows.forms.dll
> Additional information: Is not possible to evaluate. Expression
> 'Count(child([MovES_To_MovESItens]).[CodMovESItens])' is not aggregate.
>
> I'm sure about the relations/tables/fields' names.
> Please I need another sorte of eyes to look at it.
>
> Thanks!
>



 
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
how to get row number from DataTable.Compute method AboutJAV@gmail.com Microsoft ADO .NET 1 26th Feb 2010 12:59 PM
datatable.compute and CurrentRows Brian Yuill Microsoft VB .NET 1 12th Mar 2008 02:32 PM
datatable.compute Chuck Hecht Microsoft Dot NET Compact Framework 1 28th Aug 2007 03:45 AM
datatable.compute method =?Utf-8?B?RGF2aWQgQW5kZXJzb24=?= Microsoft Dot NET 1 8th Jun 2005 11:16 AM
Problem with datatable compute max(value) method Stephen Microsoft ADO .NET 5 23rd May 2005 05:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:17 PM.