sub total a bindingsource with an array
-
I need to set up an array would look something like this but I'm not sure what type basicly i have a list of occrences lets say bob rob bob joe bob joe joe rob jay jay jay rob jay jay jay rob rob joe jay jay jay and from that I would have to "sub total" the list into something like this name count bob 3 rob 5 joe 4 jay 9 1) what type of array would this be 2) how would i prevent it from adding duplicate names?
-
I need to set up an array would look something like this but I'm not sure what type basicly i have a list of occrences lets say bob rob bob joe bob joe joe rob jay jay jay rob jay jay jay rob rob joe jay jay jay and from that I would have to "sub total" the list into something like this name count bob 3 rob 5 joe 4 jay 9 1) what type of array would this be 2) how would i prevent it from adding duplicate names?
-
Any type of array would work and "you" could prevent it from adding duplicates by checking for the existence of it right? There are many different ways to do this, I would imagine you can find one of them yes? What course is this for?
its not for a class its for something at work we have a db of incidents or tickets and each ticket has a type for example: Microsoft word or outlook or account lockout I make reports for my boss each month on how many of each we had but I am currently using excel for this which sucks so I'm trying to automate it ( or at least make an app he can run himself) I currently have it so that i can download it into a datagridview and filter it using bindingsource.filter but to graph it for him i would like to get totals and i also need to consolidate the names so that i can auto populate some of the combo boxes I just didnt know if there was a better way to "link" the cells in the array so that if I found bob I could +1 the bob total with out it getting misaligned
-
its not for a class its for something at work we have a db of incidents or tickets and each ticket has a type for example: Microsoft word or outlook or account lockout I make reports for my boss each month on how many of each we had but I am currently using excel for this which sucks so I'm trying to automate it ( or at least make an app he can run himself) I currently have it so that i can download it into a datagridview and filter it using bindingsource.filter but to graph it for him i would like to get totals and i also need to consolidate the names so that i can auto populate some of the combo boxes I just didnt know if there was a better way to "link" the cells in the array so that if I found bob I could +1 the bob total with out it getting misaligned
-
crash893 wrote:
we have a db of incidents or tickets
SQL can do subtotals
crash893 wrote:
its for something at work
What do you do at work? Just curious.
I thought about using the count feature in a query but the data is filtered at the binding source by the user and it would be "to hard" to run sql querys allot on the server that has this info. so i basically take one huge dataset add it to a binding source then filter it from there (what ever the user wants to see) then the idea is that they hit a button and it produces an array that goes into a graphing class and out pops a beautiful bar graph. usatoday I'm in IT but I'm not a programmer I'm just doing this for the fun / self education. I have so far something like (this is quasi sudo code) foreach (DataRowView view in myBindingSource) { If ( array.find((string)view["cat_name"] != 1) { array.add((string)view["cat_name"] ,1) // the ,1 is the total feild so im having some trouble with that } else "find index of catname and add +1 to the total" } return array
-
I thought about using the count feature in a query but the data is filtered at the binding source by the user and it would be "to hard" to run sql querys allot on the server that has this info. so i basically take one huge dataset add it to a binding source then filter it from there (what ever the user wants to see) then the idea is that they hit a button and it produces an array that goes into a graphing class and out pops a beautiful bar graph. usatoday I'm in IT but I'm not a programmer I'm just doing this for the fun / self education. I have so far something like (this is quasi sudo code) foreach (DataRowView view in myBindingSource) { If ( array.find((string)view["cat_name"] != 1) { array.add((string)view["cat_name"] ,1) // the ,1 is the total feild so im having some trouble with that } else "find index of catname and add +1 to the total" } return array