Home All Groups Group Topic Archive Search About

Cpmute values in Dataset Table??

Author
18 Jan 2006 5:07 PM
jaawaad
Does anyone know how i can compute values from dataset table before
assigning datagrid source to it???
My data table looks something like this.

DATE                       CAT        STEP        VALUE
---------------------------------------------------------------------------
01/16/2006    AAA1    50    1
01/16/2006    AAA1    50    1
01/16/2006    AAA1    50    1
01/16/2006    AAA1    50    1
01/16/2006    AAA1    100    2
01/16/2006    AAA1    100    2
01/16/2006    AAA1    100    2
01/16/2006    AAA1    100    2
01/17/2006    BBB1    50    3
01/17/2006    BBB1    50    3
01/17/2006    BBB1    50    3
01/17/2006    BBB1    50    3
01/17/2006    BBB1    100    4
01/17/2006    BBB1    100    4
01/17/2006    BBB1    100    4
01/17/2006    BBB1    100    4

What i want to do is to be able to sum "VALUE" for each step & date.

Final Output:

DATE                       CAT        STEP        VALUE
---------------------------------------------------------------------------
01/16/2006    AAA1    050    4
01/16/2006    AAA1    100    8
01/17/2006    BBB1    050    12
01/17/2006    BBB1    100    16

Thanks for your help!

Author
18 Jan 2006 7:21 PM
krgatez
Can you just write an SQL statement to grab the sum and then add to the
dataset?
Author
18 Jan 2006 7:53 PM
jaawaad
This data table is a result of a SQL query which i cant change....so i
was wondering if there is a way to query a dataset table or view?
Author
18 Jan 2006 7:54 PM
jaawaad
This data table is a result of a SQL query which i cant change....so i
was wondering if there is a way to query a dataset table or view?
Author
18 Jan 2006 7:25 PM
Cor Ligthert [MVP]
Jaawaad,

Compute gives the values in Net alone for a complete datatable.

Probably can this sample help you to do it, although you have now to sum the
values in the for index loop.

http://www.vb-tips.com/default.aspx?ID=dcad9a66-1366-4d61-8d32-1a580eb893b2


I hope this helps,

Cor
Author
18 Jan 2006 7:57 PM
jaawaad
Cor, thanks...i will look into this example. Althoght, i was wondering
if there was an easy way to query dataset table and make a new table
out of the result.