Solved

XSL Average based on Group (In SharePoint)

Posted on 2009-05-04
5
3,484 Views
Last Modified: 2013-11-18
I am trying to get an average count based on grouped items. I have a list view that allows the user to select a field from a menu to show them numbers based on the group. So if they select Issue Type, Each Issue would then come up with  a couple of counts (In Progress, On-Hold, Resolved) based on filters, which is working and then an Average Resolution Time. I can get an average resolution time for the entire count but not individually. I have included the xsl value I am using to try and filter the resolution time based on the field selected for grouping. I have a feeling I am just putting the fiter criteria in the wrong spot but I cannot seem to get it working, below is the only thing that I have tried that came up with no XSL error.
<xsl:value-of select="format-number(sum(/dsQueryResponse/Rows/Row/@ResolveTime[@Issue_x0020_Pertains_x0020_To = $countType]) div count(/dsQueryResponse/Rows/Row/@ResolveTime[@Issue_x0020_Pertains_x0020_To = $countType]), &quot;#,##0.00;-#,##0.00&quot;)"/>

Open in new window

0
Comment
Question by:cwilliams59
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:abel
Comment Utility
I'd love to help you with this, but I need a bit more context information. From using the sum function, I take it that you use XSLT 2.0. Can you show the context of where you call the select, i.e., the grouping code around it? And add to that a bit of the XML source, so that we can help with the building of the correct expression, pls.
0
 

Author Comment

by:cwilliams59
Comment Utility
Sorry about the delay, here is all of the code I am using and a screen shot of the view. There is another problem here and that has to deal with the field for this particular group being that of 'user' and not calculating at all, but I believe that has to do with the SharePoint fields and not something else I may be overlooking, If you could help me with that too that would be great, but the Average is not working on my other group types either, just the basic counts.
<WebPartPages:DataFormWebPart runat="server" SuppressWebPartChrome="False" Description="" PartImageSmall="" MissingAssembly="Cannot import this Web Part." ListName="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}" FrameType="Default" ConnectionID="00000000-0000-0000-0000-000000000000" DetailLink="" ExportControlledProperties="True" IsVisible="True" AllowRemove="True" AllowEdit="True" ID="g_e6a31386_294f_4a1b_a4ce_542d6a5a574f" Dir="Default" FrameState="Normal" ViewContentTypeId="" AllowConnect="True" PageSize="-1" Default="FALSE" AllowMinimize="True" IsIncludedFilter="" ShowWithSampleData="False" HelpMode="Modeless" ExportMode="All" ViewFlag="0" Title="Opportunities" HelpLink="" AllowHide="True" AllowZoneChange="True" PartOrder="1" UseSQLDataSourcePaging="True" PartImageLarge="" IsIncluded="True" NoDefaultStyle="TRUE" __MarkupType="vsattributemarkup" __WebPartId="{9DECC5DB-5619-4B5F-8145-CF1155DB9198}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataSources>

<SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;And&gt;&lt;Geq&gt;&lt;FieldRef Name=&quot;Date_x0020_Submitted&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;{start}&lt;/Value&gt;&lt;/Geq&gt;&lt;Leq&gt;&lt;FieldRef Name=&quot;Date_x0020_Submitted&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;{end}&lt;/Value&gt;&lt;/Leq&gt;&lt;/And&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UseInternalName="true" ID="Opportunities1"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}"/><WebPartPages:DataFormParameter Name="end" ParameterKey="end" PropertyName="ParameterValues"/><WebPartPages:DataFormParameter Name="start" ParameterKey="start" PropertyName="ParameterValues"/></SelectParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}"/></InsertParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}"/></DeleteParameters>

	</SharePoint:SPDataSource>

</DataSources>

<ParameterBindings>

	<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>

	<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>

	<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

	<ParameterBinding Name="dvt_groupdir" Location="Postback;Connection"/>

	<ParameterBinding Name="dvt_groupdisplay" Location="Postback;Connection"/>

	<ParameterBinding Name="dvt_groupfield" Location="Postback;Connection"/>

	<ParameterBinding Name="dvt_groupsorttype" Location="Postback;Connection"/>

	<ParameterBinding Name="dvt_grouptype" Location="Postback;Connection"/>

	<ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>

	<ParameterBinding Name="ListID" Location="None" DefaultValue="{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}"/>

	<ParameterBinding Name="start" Location="QueryString(start)" DefaultValue=""/>

	<ParameterBinding Name="end" Location="QueryString(end)" DefaultValue=""/>

</ParameterBindings>

<DataFields>@Title,Task;@First_x0020_Name,First Name;@Last_x0020_Name,Last Name;@Full_x0020_Name,Full Name;@Phone_x0020_Number,Phone Number;@E_x002d_mail_x0020_Address,E-mail Address;@Resident_x0020_Address,Resident Address;@Resident_x0020_City,Resident City;@Resident_x0020_State,Resident State;@Resident_x0020_Zip,Resident Zip;@Same_x0020_Address,Task Address same as Resident;@Task_x0020_Address,Task Address;@City,City;@State,State;@Zip,Zip;@Issue_x0020_Pertains_x0020_To,Issue Pertains To;@CC_x003a_,CC:;@Details,Details;@Assigned_x0020_To,Assigned To;@Due_x0020_Date,Due Date;@Priority,Priority;@Status,Status;@Percentage_x0020_Complete,Percentage Complete;@Comments,Comments;@Keywords,Keywords;@Resolution_x0020_Date,Resolution Date;@Date_x0020_Submitted,Date Submitted;@ResolveTime,ResolveTime;@Completed_x0020_by_x0020_Due_x00,Completed by Due Date;@Emergency_x0020_Due_x0020_Date,Emergency Due Date;@AssignWo,Assign Work Order;@EmailWor,Email Work Order Info;@WOResolu,WO Resolution Date;@ID,ID;@ContentType,Content Type;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;</DataFields>

<Xsl>
 
 
 

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">

	<xsl:output method="html" indent="no"/>

	<xsl:decimal-format NaN="" grouping-separator="," decimal-separator="."/>

	<xsl:param name="dvt_apos">&apos;</xsl:param>

	<xsl:param name="dvt_groupdir">ascending</xsl:param>

	<xsl:param name="dvt_groupdisplay" />

	<xsl:param name="dvt_groupfield" />

	<xsl:param name="dvt_groupsorttype">text</xsl:param>

	<xsl:param name="dvt_grouptype" />

	<xsl:param name="dvt_sortdir">ascending</xsl:param>

	<xsl:param name="ListID">{FC86853C-4049-4228-9ED0-4C0CBD55D2AB}</xsl:param>

	<xsl:param name="start" />

	<xsl:param name="end" />

	<xsl:variable name="dvt_1_automode">0</xsl:variable>

	

	<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">

		<xsl:call-template name="dvt_1"/>

	</xsl:template>

	<xsl:template name="dvt_1">

		<xsl:variable name="dvt_StyleName">Table</xsl:variable>

		<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>

		<xsl:variable name="dvt_RowCount" select="count($Rows)" />

		<xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" />

		<xsl:call-template name="dvt_1.toolbar">

			<xsl:with-param name="Rows" select="$Rows" />

		</xsl:call-template>

		<xsl:call-template name="dvt_1.header">

			<xsl:with-param name="Rows" select="$Rows" />

		</xsl:call-template>

		<xsl:choose>

			<xsl:when test="$dvt_IsEmpty">

				<xsl:call-template name="dvt_1.empty" />

			</xsl:when>

			<xsl:otherwise><table border="0" width="100%" cellpadding="2" cellspacing="0">

			<xsl:call-template name="dvt_1.body">

				<xsl:with-param name="Rows" select="$Rows"/>

				<xsl:with-param name="FirstRow" select="1" />

				<xsl:with-param name="LastRow" select="$dvt_RowCount" />

			</xsl:call-template>

		</table></xsl:otherwise>

		</xsl:choose>

	</xsl:template>
 

	<xsl:template name="dvt_1.body">

		<xsl:param name="Rows"/>

		<xsl:param name="FirstRow" />

		<xsl:param name="LastRow" />

		<xsl:for-each select="$Rows">

			<xsl:sort select="*[name() = $dvt_groupfield] | @*[name() = $dvt_groupfield] | text()[name(ancestor::*[1]) = $dvt_groupfield]" order="{$dvt_groupdir}" data-type="{$dvt_groupsorttype}" />

			<xsl:variable name="NewGroup_adhoc">

							<xsl:choose>

											<xsl:when test="$dvt_groupfield and $dvt_grouptype != 'user'"><xsl:value-of select="ddwrt:NameChanged(string(*[name()=$dvt_groupfield] | @*[name()=$dvt_groupfield] | current()[name(.) = $dvt_groupfield]), 0)" /></xsl:when>

											<xsl:when test="$dvt_groupfield and $dvt_grouptype = 'user'"><xsl:value-of select="ddwrt:NameChanged(substring-before(string(*[name()=$dvt_groupfield] | @*[name()=$dvt_groupfield] | current()[name(.) = $dvt_groupfield]), '/A'), 0)" /></xsl:when>

											<xsl:otherwise></xsl:otherwise>

							</xsl:choose>

			</xsl:variable>

			<xsl:call-template name="dvt_1.rowview" />

			<xsl:variable name="groupname" select="string(*[name()=$dvt_groupfield] | @*[name()=$dvt_groupfield] | current()[name(.) = $dvt_groupfield])" />

			

			

			

			<xsl:if test="(not($NewGroup_adhoc='') or position()=$FirstRow)and $dvt_groupfield and position() &gt;= $FirstRow and position() &lt;= $LastRow">

							<xsl:choose>

											<xsl:when test="$dvt_grouptype = 'user'">

															<xsl:call-template name="dvt_1.groupheader">

																			<xsl:with-param name="fieldtitle" select="$dvt_groupdisplay" />

																			<xsl:with-param name="fieldname" select="$dvt_groupdisplay" />

																			<xsl:with-param name="fieldvalue">

																							<xsl:choose>

																											<xsl:when test="$dvt_grouptype='isodatetime'"><xsl:value-of select="ddwrt:GenDisplayName(string($groupname))" /></xsl:when>

																											<xsl:otherwise><xsl:value-of select="$groupname" /></xsl:otherwise>

																							</xsl:choose>

																			</xsl:with-param>

																			<xsl:with-param name="fieldtype" select="$dvt_grouptype" />

																			<xsl:with-param name="nodeset" select="$Rows[substring-before(@*[name()=$dvt_groupfield],'/A') = substring-before($groupname,'/A')]"/> 

																			<xsl:with-param name="groupid" select="'9'" />

																			<xsl:with-param name="displaystyle" select="'auto'" />

																			<xsl:with-param name="imagesrc" select="'/_layouts/images/minus.gif'" />

																			<xsl:with-param name="alttext" select="'collapse'" />

																			<xsl:with-param name="altname" select="'expand'" />

																			<xsl:with-param name="hidedetail" select="false()" />

																			<xsl:with-param name="showheader" select="true()" />

																			<xsl:with-param name="showheadercolumn" select="false()" />

															</xsl:call-template>

											</xsl:when>

											<xsl:otherwise>

															<xsl:call-template name="dvt_1.groupheader">

																			<xsl:with-param name="fieldtitle" select="$dvt_groupdisplay" />

																			<xsl:with-param name="fieldname" select="$dvt_groupdisplay" />

																			<xsl:with-param name="fieldvalue">

																							<xsl:choose>

																											<xsl:when test="$dvt_grouptype='isodatetime'"><xsl:value-of select="ddwrt:GenDisplayName(string($groupname))" /></xsl:when>

																											<xsl:otherwise><xsl:value-of select="$groupname" /></xsl:otherwise>

																							</xsl:choose>

																			</xsl:with-param>

																			<xsl:with-param name="fieldtype" select="$dvt_grouptype" />

																			<xsl:with-param name="nodeset" select="$Rows[@*[name()=$dvt_groupfield] = $groupname]"/> 

																			<xsl:with-param name="groupid" select="'9'" />

																			<xsl:with-param name="displaystyle" select="'auto'" />

																			<xsl:with-param name="imagesrc" select="'/_layouts/images/minus.gif'" />

																			<xsl:with-param name="alttext" select="'collapse'" />

																			<xsl:with-param name="altname" select="'expand'" />

																			<xsl:with-param name="hidedetail" select="false()" />

																			<xsl:with-param name="showheader" select="true()" />

																			<xsl:with-param name="showheadercolumn" select="false()" />

															</xsl:call-template>

											</xsl:otherwise>

							</xsl:choose>

			</xsl:if>

			<xsl:if test="(position() = $LastRow or (position()=last() and $LastRow &gt; last())) and $dvt_groupfield">

				<xsl:value-of select="ddwrt:NameChanged('', -1)" />

			</xsl:if></xsl:for-each>

		

	</xsl:template>

	

<!--ROW VIEW TEMPLATE-->	

	<xsl:template name="dvt_1.rowview">

		<tr  class="ms-hidden">		

		</tr>

	</xsl:template>

	

	<xsl:template name="dvt_1.empty">

		<xsl:variable name="dvt_ViewEmptyText">There are no items to show in this view.</xsl:variable>

		<table border="0" width="100%">

			<tr>

				<td class="ms-vb">

					<xsl:value-of select="$dvt_ViewEmptyText" />

				</td>

			</tr>

		</table>

	</xsl:template>

	

<!--GROUP HEADER TEMPLATE-->	

	<xsl:template name="dvt_1.groupheader">

		<xsl:param name="fieldtitle" />

		<xsl:param name="fieldname" />

		<xsl:param name="fieldvalue" />

		<xsl:param name="fieldtype" />

		<xsl:param name="nodeset" />

		<xsl:param name="groupid" />

		<xsl:param name="displaystyle" />

		<xsl:param name="imagesrc" />

		<xsl:param name="alttext" />

		<xsl:param name="altname" />

		<xsl:param name="hidedetail" />

		<xsl:param name="showheader" />

		<xsl:param name="showheadercolumn" />

		<xsl:if test="$showheader" ddwrt:cf_ignore="1">

			<tr id="group{$groupid}" style="display:{$displaystyle}">

				<td class="ms-gb" style="background:#cccccc;" colspan="13">

					<xsl:choose>

						<xsl:when test="$groupid='0' or $groupid='9'">

							<xsl:text></xsl:text>

						</xsl:when>

						<xsl:when test="$groupid='1'">

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

						</xsl:when>

						<xsl:when test="$groupid='2'">

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

						</xsl:when>

						<xsl:otherwise>

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

							<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

						</xsl:otherwise>

					</xsl:choose>

					<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>

					<b>

						<xsl:value-of select="$fieldtitle" />

					</b>

					<xsl:if test="$fieldtitle">: </xsl:if>

					<xsl:choose>

						<xsl:when test="$fieldtype='url'">

							<a href="{$fieldvalue}">

								<xsl:value-of select="$fieldvalue" />

							</a>

						</xsl:when>

						<xsl:when test="$fieldtype='user'">

							<xsl:value-of select="$fieldvalue" disable-output-escaping="yes"/>

						</xsl:when>

						<xsl:otherwise>

							<xsl:value-of select="$fieldvalue" disable-output-escaping="yes"/>

						</xsl:otherwise>

					</xsl:choose>

					

 					<xsl:variable name="modifiednodeset">

						<xsl:for-each select="$nodeset">

							<Row Name="{translate(@Title,'.','.')}"/>

						</xsl:for-each>

					</xsl:variable>

					<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  			

  					</xsl:text>

<!--NODESET COUNT-->  					

	  				<table><tr><td class="ms-vb" style="padding-left: 10px"># of Tasks: <xsl:value-of select="(count(msxsl:node-set($modifiednodeset)/Row/@Name))"/> <br />

<!--CHOOSE STATEMENT FOR GROUP HEADER SELECTION - This calls the appropriate Counts based on the Group Type-->	  				

	  				<xsl:choose>

	  					<xsl:when test="$fieldtitle = 'Issue Pertains To'">

	  					<xsl:call-template name="IssueType">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Assigned To'">

	  					<xsl:call-template name="AssignedTo">

	  						<xsl:with-param name="countType" select="$fieldvalue"  />

	  						<xsl:with-param name="typeOfField" select="$fieldtype" />

	  					</xsl:call-template>

	  				</xsl:when>

					<xsl:when test="$fieldtitle = 'Task'">

	  					<xsl:call-template name="Task">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Task Address'">

	  					<xsl:call-template name="TaskAddress">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Task Reporter'">

	  					<xsl:call-template name="TaskReporter">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Due Date'">

	  					<xsl:call-template name="DueDate">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Date Submitted'">

	  					<xsl:call-template name="DateSubmitted">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Resolution Date'">

	  					<xsl:call-template name="ResolutionDate">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Priority'">

	  					<xsl:call-template name="Priority">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				<xsl:when test="$fieldtitle = 'Status'">

	  					<xsl:call-template name="Status">

	  						<xsl:with-param name="countType" select="$fieldvalue" />

	  					</xsl:call-template>

	  				</xsl:when>

	  				</xsl:choose>

	  				</td></tr></table>

	  			</td>

			</tr>

		</xsl:if>

	</xsl:template>

	

<!--TEMPLATES FOR GROUP TYPE COUNTS-->	

	<xsl:template name="IssueType">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Issue_x0020_Pertains_x0020_To = $countType][@Status = 'In-Progress']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				On-Hold:  <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Issue_x0020_Pertains_x0020_To = $countType][normalize-space(@Status) = 'On-Hold']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Resolved: <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Issue_x0020_Pertains_x0020_To = $countType][normalize-space(@Status) = 'Resolved']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Completed by Due Date: <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Issue_x0020_Pertains_x0020_To = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1]), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Average Resolution Time: <xsl:value-of select="format-number((sum(/dsQueryResponse/Rows/Row/@ResolveTime[@Issue_x0020_Pertains_x0020_To = $countType]) div count(/dsQueryResponse/Rows/Row/@ResolveTime[@Issue_x0020_Pertains_x0020_To = $countType])), &quot;#,##0.00;-#,##0.00&quot;)"/>

	</xsl:template>

	<xsl:template name="AssignedTo">

	  				<xsl:param name="countType" />

	  				

	  				In-Progress:  <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Assigned_x0020_To = $countType][normalize-space(@Status) = 'In-Progress']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				On-Hold:  <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Assigned_x0020_To = $countType][normalize-space(@Status) = 'On-Hold']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Resolved: <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Assigned_x0020_To = $countType][normalize-space(@Status) = 'Resolved']), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Completed by Due Date: <xsl:value-of select="format-number(count(/dsQueryResponse/Rows/Row[@Assigned_x0020_To = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1]), &quot;#,##0.;-#,##0.&quot;)"/> <br />

	  				Average Resolution Time: <xsl:value-of select="format-number(sum(/dsQueryResponse/Rows/Row/@ResolveTime[@Assigned_x0020_To = $countType]) div count(/dsQueryResponse/Rows/Row/@ResolveTime[@Assigned_x0020_To = $countType]), &quot;#,##0.;-#,##0.&quot;)"/>	

	</xsl:template>

	<xsl:template name="Task">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Title = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Title = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Title = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Title = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="TaskAddress">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Task_x0020_Address = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Task_x0020_Address = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Task_x0020_Address = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Task_x0020_Address = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="TaskReporter">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Full_x0020_Name = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Full_x0020_Name = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Full_x0020_Name = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Full_x0020_Name = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="DueDate">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Due_x0020_Date = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Due_x0020_Date = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Due_x0020_Date = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Due_x0020_Date = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="DateSubmitted">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Date_x0020_Submitted = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Date_x0020_Submitted = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Date_x0020_Submitted = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Date_x0020_Submitted = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="ResolutionDate">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Resolution_x0020_Date = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Resolution_x0020_Date = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Resolution_x0020_Date = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Resolution_x0020_Date = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="Priority">

	  				<xsl:param name="countType" /> 

	  				In-Progress:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Priority = $countType][@Status = 'In-Progress'])"/> <br />

	  				On-Hold:  <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Priority = $countType][normalize-space(@Status) = 'On-Hold'])"/> <br />

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Priority = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Priority = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

	<xsl:template name="Status">

	  				<xsl:param name="countType" /> 

	  				Resolved: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Status = $countType][normalize-space(@Status) = 'Resolved'])"/> <br />

	  				Completed by Due Date: <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Status = $countType][normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1])"/> <br />

	</xsl:template>

<!--END OF GROUP TYPE TEMPLATES-->	
 

<!--CONTAINS TOTAL SUMMARY OF ALL ITEMS WITHIN DATE RANGE - HEADER TEMPLATE-->	

		<xsl:template name="dvt_1.header">

		<xsl:param name="Rows" />

		<table cellSpacing="0" cellPadding="4" border="0" width="100%">

			<tr>

				<td class="ms-vb">

					<strong>Total Task Count : <xsl:value-of select="count(/dsQueryResponse/Rows/Row)" /></strong></td>

			</tr>

			<tr>

				<td class="ms-vb">

					<strong>In-Progress : <xsl:value-of select="(count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'In-Progress']))"/></strong></td>

			</tr>

			<tr>

				<td class="ms-vb">

					<strong>On-Hold : <xsl:value-of select="(count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'On-Hold']))"/></strong></td>

			</tr>

			<tr>

				<td class="ms-vb">

					<strong>Resolved : <xsl:value-of select="(count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Resolved']))"/></strong></td>

			</tr>

			<tr>

				<td class="ms-vb">

					<strong>Completed by Due Date : <xsl:value-of select="(count(/dsQueryResponse/Rows/Row[normalize-space(@Completed_x0020_by_x0020_Due_x00) = 1]))"/></strong></td>

			</tr>

			<tr>

				<td class="ms-vb">

					<strong>Average Resolution Time : <xsl:value-of select="format-number(sum(/dsQueryResponse/Rows/Row/@ResolveTime) div count(/dsQueryResponse/Rows/Row/@ResolveTime), &quot;#,##0.00;-#,##0.00&quot;)"/></strong></td>

			</tr>

		</table>

	</xsl:template>

	

<!--GROUP TOOLBAR-->	

	<xsl:template name="dvt_1.toolbar">

		<xsl:param name="Rows" />

		<table cellSpacing="0" cellPadding="2" border="0" class="ms-toolbar" style="margin-left: 3px; margin-right: 5px;">

			<tr class="ms-availablereports">

				<td id="dvt_tb_group" nowrap=""><table><tr><td nowrap="" class="ms-toolbar"><nobr><select>

					<xsl:variable name="clvar1_dvt_groupfield">&apos; + this.options[this.selectedIndex].value + &apos;</xsl:variable>

					<xsl:variable name="clvar2_dvt_groupfield">&apos; + this.options[this.selectedIndex].fieldtype + &apos;</xsl:variable>

					<xsl:variable name="clvar3_dvt_groupfield">&apos; + this.options[this.selectedIndex].title + &apos;</xsl:variable>

					<xsl:variable name="clvar4_dvt_groupfield">&apos; + this.options[this.selectedIndex].sorttype + &apos;</xsl:variable>

					<xsl:attribute name="OnChange">javascript:<xsl:value-of select="ddwrt:GenFireServerEvent(concat('NotUTF8;dvt_groupfield={', $clvar1_dvt_groupfield, '};dvt_sortdir={', $dvt_sortdir, '};dvt_grouptype={', $clvar2_dvt_groupfield, '};dvt_groupdisplay={', $clvar3_dvt_groupfield, '};dvt_groupsorttype={', $clvar4_dvt_groupfield, '}'))" /></xsl:attribute>

<!--GROUP BY OPTIONS -->					

					<option value="Issue_x0020_Pertains_x0020_To" fieldtype="" title="Issue Pertains To" sorttype="number">(None)</option>

							<option value="Assigned_x0020_To" fieldtype="user" title="Assigned To"><xsl:if test="$dvt_groupfield='Assigned To'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Assigned To</option>

							<option value="Title" fieldtype="" title="Task"><xsl:if test="$dvt_groupfield='Task'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Task</option>

							<option value="Task_x0020_Address" fieldtype="" title="Task Address"><xsl:if test="$dvt_groupfield='Task Address'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Task Address</option>			

							<option value="Full_x0020_Name"  title="Full Name"><xsl:if test="$dvt_groupfield='Full Name'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Task Reporter</option>

							<option value="Issue_x0020_Pertains_x0020_To" fieldtype="" title="Issue Pertains To" sorttype="number"><xsl:if test="$dvt_groupfield='IssuePertainsTo' and $dvt_groupsorttype='number'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Issue Pertains To</option>

						<!--<option value="Due_x0020_Date" fieldtype="" title="Due Date"><xsl:if test="$dvt_groupfield='Due Date'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Due Date</option>-->	

							<option value="Date_x0020_Submitted" fieldtype="" title="Date Submitted"><xsl:if test="$dvt_groupfield='Date Submitted'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Date Submitted</option>

						<!--<option value="Resolution_x0020_Date" fieldtype="" title="Resolution Date"><xsl:if test="$dvt_groupfield='Resolution Date'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Resolution Date</option> -->

							<option value="Priority" fieldtype="" title="Priority"><xsl:if test="$dvt_groupfield='Priority'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Priority</option>	

						<!--<option value="Status" fieldtype="" title="Status"><xsl:if test="$dvt_groupfield='Status'"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>Status</option>	-->											

					</select>

<!--END OF GROUP BY OPTIONS-->

					<a>

					<xsl:attribute name="href">

						<xsl:choose>

							<xsl:when test="$dvt_groupdir='descending'">javascript:<xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_groupfield={', $dvt_groupfield, '};dvt_groupdir={ascending}'))" /></xsl:when>

							<xsl:otherwise>javascript:<xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_groupfield={', $dvt_groupfield, '};dvt_groupdir={descending}'))" /></xsl:otherwise>

						</xsl:choose>

					</xsl:attribute>

					<xsl:if test="$dvt_groupfield" ddwrt:cf_ignore="1"><img border="0">

						<xsl:attribute name="src">

							<xsl:choose>

								<xsl:when test="$dvt_groupdir='descending'"><xsl:value-of select="ddwrt:FieldSortImageUrl('Asc')" /></xsl:when>

								<xsl:otherwise><xsl:value-of select="ddwrt:FieldSortImageUrl('Desc')" /></xsl:otherwise>

							</xsl:choose>

						</xsl:attribute>

						<xsl:attribute name="alt">

							<xsl:choose>

								<xsl:when test="$dvt_groupdir='descending'">Descending</xsl:when>

								<xsl:otherwise>Ascending</xsl:otherwise>

							</xsl:choose>

						</xsl:attribute>

						</img></xsl:if>

					</a></nobr></td></tr></table></td><td width="99%"></td>

			</tr>

		</table>

	</xsl:template></xsl:stylesheet>	</Xsl>

</WebPartPages:DataFormWebPart>

Open in new window

5-8-2009-2-52-38-PM.jpg
0
 
LVL 39

Assisted Solution

by:abel
abel earned 350 total points
Comment Utility
I copied your code and reformatted it a bit to make it more readable. What I am missing actually is the input data for the XSLT. The sum function references a nodeset that is specified from the root as being /dsQueryResponse/Rows/Row/@ResolveTime... etc. In the code you posted, the XML with the dsQueryResponse is missing. Without that I cannot be of much help I'm afraid, can you upload that too, please?
0
 

Accepted Solution

by:
cwilliams59 earned 0 total points
Comment Utility
Thanks for trying to work with me on this, I figured it out just now I was not writing the syntax correctly. This is what I ended up with. Turns out the part I was missing was ../ before @Issue_x0020_Pertains_x0020_To. Now I cant stop kicking myself.
<xsl:value-of select="format-number(sum(/dsQueryResponse/Rows/Row/@ResolveTime[../@Issue_x0020_Pertains_x0020_To = $countType])div count(/dsQueryResponse/Rows/Row[@Issue_x0020_Pertains_x0020_To = $countType][@Status = 'Resolved']), '#,##0.00;-#,##0.00')"/>

Open in new window

0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Glad you found it out. No objections here to the closing request.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now