SP2010: I need to come up with a total (number) of a column for all entries in a list. For instance:
Given a list with entries which can be comprised of apples, oranges, and pears, and their corresponding counts, with the first column being the type, second column being the count. There can be multiple entries for each type. How do I total the count?
Column1 = type; Column2 = count
- apple; 20
- apple; 15
- pear; 12
- orange; 30
- pear; 20
- orange; 19
I can get the list item count using the following:
<xsl:variable name="count" select="count(dsQueryResponse/Rows/Row[normalize-space(@type) = 'apple']) />
If this is used, on the above list, it would make the variable count = 2 where the type equals apple. What would I need to use to sum up the column of an entire list? With the above, the apple total would be 35.
To round out what I'm doing, I'm using the variables to plug into jQuery/flot to display into a bar graph through an aspx page. I'm doing my coding using SPD2010. The data is being drawn from the list using a Data View WebPart. I cannot use/purchase/install any third party software (like Nevron Chart ) whether free or not. Visual Studio is not available to me. Please let me know if more information is needed.
I found I can do a sum of all of the line items by doing the following:
<xsl:value-of select="sum(dsQueryResponse/Rows/Row/@type)" />
But not sure how to segregate "apple" from "pear" using this.