Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Elements from My Array

 
Steve Dyke
Ranch Hand
Posts: 1629
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an two dimensional array with three elements for each item(4624 items), One array for each employee(26-40). These are date, hours, taskid. My goal is to have a report that shows 39 weeks from this week and show the amount of hours each employee has scheduled each week. My question is how to get the data from my array, grouping on week ending matching each of the 39 weeks in my report.

If I loop thru the 39 week periods then loop thru my array to find matching dates would this be the most effecient way?

By the way I had this working by using sql to feed data into an iseries file then getting data back out with sql etc. But this is way too much traffic on our server.
 
Eric Weinberg
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using multi dimensional arrays to represent class data?

Why not create an Employee object that has 3 members, hours, date, taskid. You can then just have a regular ol 1-d array of Employees.
 
Nickolas Case
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use a hash? That way you could have a key(say date) that would contain all the values you are looking for. Looking through the API, it looks as though a hashtable would be your best bet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic