Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

 

SELECT PeopleID, SUM(HoursWorked)
  FROM WorkHistory
GROUP BY PeopleID

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...