Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Wed Oct 22, 2014 6:22 pm

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:12 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
I'm working on a dash board and am a bit stumped. I'm trying to add a completion percentage in my group header of my dataview web part.

Ideally I'd like to look at my document status column and test if the status is complete and divide that by the total documents belonging to that group.

I've added a xsl:with param and a xsl:param to my templates and can see my parameter as a able to be utilized. When I try and use count(@Document_x0020_Status) in the header, it just returns 1 and not the count of the grouped items.

What do I have to do to get this to count the values of the group, then derive a percentage?


Top
 Profile  
 
 Post subject: Re: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:16 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 4:29 pm
Posts: 589
Location: Boston, MA, USA
You need to give count() a nodeset to work with, like count($Rows). You're passing a single node to count(), so you're getting back the value 1.

In this case, you probably want something like:
Code:
<xsl:value-of select="count($Rows[@Status = "Complete"]) div count($Rows)"/>

M.


Top
 Profile  
 
 Post subject: Re: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:26 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
Yep, that's close. Instead of doing it for each heading though, it's doing it aggregate for all items.


Top
 Profile  
 
 Post subject: Re: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:29 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 4:29 pm
Posts: 589
Location: Boston, MA, USA
Ok, then you'll need to add the extra filter to the nodeset. Something like:
Code:
<xsl:value-of select="count($Rows[@GroupingColumn = current()/@GroupingColumn and @Status = "Complete"]) div count($Rows[@GroupingColumn = current()/@GroupingColumn])"/>

M.


Top
 Profile  
 
 Post subject: Re: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:35 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
Perfecto, you're the man Marc. See you in DC!


Top
 Profile  
 
 Post subject: Re: Adding totals to group header of DVWP
PostPosted: Wed May 12, 2010 4:37 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 4:29 pm
Posts: 589
Location: Boston, MA, USA
;=)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group