I always detested that when you convert a standard SharePoint Web Part, that shows totals for columns (count, sum, etc.), into an XSLT dataview web part within SharePoint Designer, the totals disappear. This never made much sense to me, as every other part of the view is translated into the appropriate XSLT code. So this post will discuss how to put those totals back in.When you group by a field in XSLT, the header for each group boils down to displayingTo resolve this problem just follow the steps
Step 1: Add List View Web part on SharePoint webpart page as shown in the fig
Step 2: Select Modify Shared Web part and edit current view of listview web part as shown in the fig
Step 3: Select Only ID column as Shown in the fig
Step 4: Expand Group By Field and select Status column
Step 5: Expand Total Field and Select ID Total equal to count
Step 6: Set Toolbar equal to No Toolbar
Step 7: Now ListView webpart looks like as shown in the fig
Step 8: Open Default.aspx page in sharepoint designer
Step 9: Convert Listview webpart into xslt view as shown in the figJust right click on listview webpart and select convert to XSLT Data view
Step 10: Add additional code after group by field to show row count<xsl:value-of select=”count(/dsQueryResponse/Rows/Row[@Status = $fieldvalue])”/>Original code:<xsl:otherwise><xsl:value-of select=”$fieldvalue”></xsl:value-of>Modifying Code:<xsl:otherwise><xsl:value-of select=”$fieldvalue”></xsl:value-of> [<xsl:value-of select=”count(/dsQueryResponse/Rows/Row[@Status = $fieldvalue])”/>]</xsl:otherwise>
Step 11: Show total row counts in the current view just add following line<b style=”padding-left:10px;padding-top:5px; font-family:Tahoma;font-size:8pt;font-weight:700;”>Total Calls :[<xsl:value-of select=”count(/dsQueryResponse/Rows/Row)”/>]</b>
Step 12: Remove ID Column from XSLT view as highlighted in the screen dump
Step 13: Job is done now List view webpart only show row count according to status wise (Group by Field wise) without any field displaySo I am counting (for each header) the number of items where the list item value for the Day field equals the current group header value. The final result is shown below
Njoy !!!!
good stuff . 🙂 . Continue blogging.
I love this post.
But I have a question, Can I order the groups by count value? Can you help me please?
Best Regars and Thank you very much.
Hi Very Nice Post.
I need order the groups by Count value, I can´t it, I am very tired, Can you Help me if you have any Idea or Information?
really gud 🙂