I am using sharepoint designer 2007 to modify WSS 3.0 sites and I have a custom dataview for a webpart and I want to sum a calculated column.
The calculated column is a product of PricePerUnit & Quantity. I know practically nothing about xslt and have tried sum( $nodeset/@PricePerUnit*@Quantity ) but it errors out and sum($Rows/...) doesn't work either.
Anyone with any experience or direction would be greatly appreciate, so THANK YOU in advance.
Current Code:
<xsl:template name="dvt_1.groupfooter0"><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="showfooter" /><xsl:param name="showfootercolumn" /><xsl:if test="$showfootercolumn" ddwrt:cf_ignore="1"><tr valign="top"><xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1"><th class="ms-vh" width="1%" nowrap="nowrap"></th></xsl:if><td class="ms-vh" nowrap=""><xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text></td><td class="ms-vh" nowrap=""><xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text></td><td class="ms-vh" nowrap=""><xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text></td><td class="ms-vh" nowrap=""><xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text></td><td class="ms-vh" nowrap=""><xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text></td><td class="ms-vh" nowrap=""><xsl:value-of select="sum($nodeset/@Number_x0020_of_x0020_Units)" /></td></tr></xsl:if><xsl:if test="$showfooter" ddwrt:cf_ignore="1"><tr id="group{$groupid}" style="display:{$displaystyle}"><td class="ms-gb" style="background:#cccccc;" colspan="99"><xsl:choose><xsl:when test="$groupid='0' or $groupid='9'"></xsl:when><xsl:when test="$groupid='1'"><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text></xsl:when><xsl:when test="$groupid='2'"><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text></xsl:when><xsl:otherwise><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;</xsl:text></xsl:otherwise></xsl:choose><b>Count : <xsl:value-of select="sum($nodeset/@UnitCost*@Quantity)" /></b></td></tr></xsl:if></xsl:template>
I did come across this, which seems to be what I may need, but I am not seeing how to relate the information. I think they are doing the math behind, storing them in other variable, then just writing the sum of those in as the output, but again, not getting it.
<xsl:template match="/items"><xsl:call-template name="recursivesum"><xsl:with-param name="items" select="*" /></xsl:call-template></xsl:template><xsl:template name="recursivesum"><xsl:param name="items" /><xsl:param name="sum" select="0" /><xsl:variable name="head" select="$items[1]" /><xsl:variable name="tail" select="$items[position()>1]" /><xsl:variable name="thissum" select="$head/value * $head/quantity" /><xsl:choose><xsl:when test="not($tail)"><xsl:value-of select="$sum+$thissum" /></xsl:when><xsl:otherwise><xsl:call-template name="recursivesum"><xsl:with-param name="sum" select="$sum+$thissum" /><xsl:with-param name="items" select="$tail" /></xsl:call-template></xsl:otherwise></xsl:choose></xsl:template>If anyone can point me in the right direction I would be greatly appreciative, also, if there is another way that is just as good I would be willing. I am not married to SPD, but a Workflow hasn't seemed like the best solution either.
Sean Page SBS 2003 SP2