Datatable sort an filter

trend

Well-known member
Joined
Oct 12, 2004
Messages
171
Here is my Org Post.. Org I was going to use an Array, but some people said it would be easier done with a DataTable:

Hello, I have an array returned with these fields:

Name, AmountDue, TypeID, Description

The array is (100,1) and string type

My problem is.. Some of the people in the array are in there more than once.. (For example they get a bonus on top of their hourly pay).

How can I get an array with each entry having a unique Name.. and where the AmountDue is the combination of all money owed to them?

example:
OrgArray(100,1)

OrgArray(0,0) = "Jay"
OrgArray(0,1) = "10.00"
OrgArray(1,0) = "Jay"
OrgArray(1,1) = "1.00"
OrgArray(2,0) = "David"
OrgArray(2,1) = "10.00"
OrgArray(3,0) = "Erin"
OrgArray(3,1) = "10.00"
OrgArray(4,0) = "David"
OrgArray(4,1) = "1.00"


NewArray(100,1) should be something like:
"Jay" = NewArray(0,0)
"11.00" = NewArray(0,1)
"David" = NewArray(1,0)
"11.00" = NewArray(1,1)
"Erin" = NewArray(2,0)
"10.00" = NewArray(2,1)

Any ideas?

thanks
 
Is this data coming out of a database? If so, simply group by the unique identifier for the person, e.g.

Code:
SELECT PeopleID, SUM(HoursWorked)
   FROM WorkHistory
 GROUP BY PeopleID
 
Back
Top