Monday, November 17, 2008

Re: [sharepointdiscussions] Re:convert excel formula to xsl for use in data form web part

I tried the solution that you recommended, and the result that I get is not correct.  I must have screwed something up somewhere in the code.  All of which is pasted here for reference.  Once I can get this value, I can plug it into a variable to use, but getting the initial value is proving the most difficult.

   <WebPartPages:DataFormWebPart runat="server" __markuptype="vsattributemarkup" ViewFlag="9" ViewContentTypeId="0x" DetailLink="/HelpDesk/Lists/Service Requests/My Active Service Requests.aspx" Width="" Height="" FrameState="Normal" IsIncluded="true" IsVisible="true" Dir="Default" AllowRemove="true" AllowZoneChange="true" AllowMinimize="true" Description="Use the Service Requests list to track detailed information and resolutions for service requests." MissingAssembly="Cannot import this Web Part." PartImageSmall="" PartImageLarge="/_layouts/images/ittask.gif" PartOrder="2" DisplayName="" ListName="{091F2CA2-D414-4DE2-B9B2-EB48448566B3}" Title="Service Requests (1)" FrameType="Default" NoDefaultStyle="TRUE" __WebPartId="{724A9A85-A56C-41BA-A4E8-A498124C0570}" id="g_724a9a85_a56c_41ba_a4e8_a498124c0570" pagesize="100">
<DataSources>
<SharePoint:SPDataSource runat="server" IncludeHidden="true" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&#xA;   &lt;Eq&gt;&#xA;    &lt;FieldRef Name=&quot;Status&quot;/&gt;&#xA;    &lt;Value Type=&quot;Text&quot;&gt;Closed&lt;/Value&gt;&#xA;   &lt;/Eq&gt;&#xA;  &lt;/Where&gt;&#xA;  &lt;OrderBy&gt;&lt;FieldRef Name=&quot;DueDate&quot; Ascending=&quot;TRUE&quot;/&gt;&lt;/OrderBy&gt;&lt;GroupBy Collapse=&quot;TRUE&quot;&gt;&#xA;   &lt;FieldRef Name=&quot;DueDate&quot;/&gt;&#xA;  &lt;/GroupBy&gt;&#xA; &lt;/Query&gt;&lt;/View&gt;" id="datasource1" DataSourceMode="List" UseInternalName="true"><InsertParameters><asp:Parameter DefaultValue="{091F2CA2-D414-4DE2-B9B2-EB48448566B3}" Name="ListID"></asp:Parameter>
  </InsertParameters><UpdateParameters><asp:Parameter DefaultValue="{091F2CA2-D414-4DE2-B9B2-EB48448566B3}" Name="ListID"></asp:Parameter>
  </UpdateParameters><DeleteParameters><asp:Parameter DefaultValue="{091F2CA2-D414-4DE2-B9B2-EB48448566B3}" Name="ListID"></asp:Parameter>
  </DeleteParameters><SelectParameters><asp:Parameter Name="ListID" DefaultValue="{091F2CA2-D414-4DE2-B9B2-EB48448566B3}"/><asp:QueryStringParameter Name="RootFolder" querystringfield="RootFolder" type="String"/><asp:Parameter Name="StartRowIndex" DefaultValue="0"/><asp:Parameter Name="nextpagedata" DefaultValue="0"/><asp:Parameter Name="MaximumRows" DefaultValue="100"/></SelectParameters>
 </SharePoint:SPDataSource>
</DataSources>
<ParameterBindings>
    <ParameterBinding Name="ListName" Location="None" DefaultValue="Service Requests"/>
    <ParameterBinding Name="Userid" Location="Postback;Connection;CAMLVariable"/>
    <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
    <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
   </ParameterBindings>
<XSL>
<xsl:stylesheet version="1.0" exclude-result-prefixes="rs z o s ddwrt dt msxsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:o="urn:schemas-microsoft-com:office" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:ddwrt2="urn:frontpage:internal"><xsl:output method="html" indent="no" /><xsl:decimal-format NaN="" />
 <xsl:param name="FilterLink" select="ddwrt:FilterLink()" />
 <xsl:param name="dvt_apos">&apos;</xsl:param>
 <xsl:param name="filterParam" ddwrt:NoCAMLVariable="1"></xsl:param>
 <xsl:param name="Userid"></xsl:param>
 <xsl:variable name="dvt_1_automode">0</xsl:variable>
 <xsl:template match="/" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20">
  <xsl:call-template name="dvt_1" />
 </xsl:template>
 <xsl:key name="Rows-by-Date" match="Row" use="@DueDate" />
 <xsl:template name="dvt_1" match="Row" mode="attr-group">
  <xsl:value-of select="@DueDate" />
  <xsl:value-of select="count(key('Rows-by-Date', @DueDate))" />
 <xsl:apply-templates mode="attr-group" select="Row[generate-id(.)=generate-id(key('Rows-by-Date', @DueDate)[1])]">
  <xsl:sort select="@DueDate"/>
 </xsl:apply-templates>
 </xsl:template>
 
</xsl:stylesheet>
</XSL>

<datafields>@Title,Service Request;@Details,Details;@Customer,Customer;@Keywords,Keywords;@Priority,Priority;@Status,Status;@AssignedTo,Assigned To;@Comments,Comments;@DueDate,Resolution Date;@Resolution_x0020_Time,Resolution Time;@StartDate,Start Date;@WorkflowLink,Link;@OffsiteParticipant,External Participant;@OffsiteParticipantReason,External Participant Reason;@WorkflowOutcome,Outcome;@ContentType,Content Type;@Resolution_x0020_Type,Resolution Type;@Resolution_x0020_Details,Resolution Details;@HelpDesk,Help Desk Notification;@Reminder,Reminders;@Workflow,Close Request;@ID,ID;@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>
</WebPartPages:DataFormWebPart>

________________________________
From: Rainer Wittmann <R.Wittmann@spirit.de>
To: "sharepointdiscussions@yahoogroups.com" <sharepointdiscussions@yahoogroups.com>
Sent: Monday, November 17, 2008 12:17:42 PM
Subject: RE: [sharepointdiscussions] Re:convert excel formula to xsl for use in data form web part


No easy way at all, but still doable.

Look for Munchian group algorithm, best described by Jeni Tennison
http://www.jenitenn ison.com/ xslt/grouping/ index.html

In a nutshell:
You want to group and count an attribute @attribute which is part of an ROW element.

Step 1: Set up a key: <xsl:key name="Rows-by- attr" match="Row" use="@attribute" />

Step 2: Create a template with mode attr-group.

<xsl:template match="Row" mode="attr-group" >
<xsl:value-of select="@attribute" />
(<xsl:value- of select="count( key(' Rows-by-attr, @attribute)) " />)
</xsl:template>

Step 3: Wherever you are interested in the result apply the template from step 2:

<xsl:apply-template s mode="attr-group" select="Row[ generate- id(.) = generate-id( key(Rows- by-attr ', @attribute)[ 1])]"> <xsl:sort select="@attribute" />
</xsl:apply- templates>

Step 4: Find out what did go wrong when you implemented 1-3, which is the hardest part at all.

Good luck

Rainer

-----Original Message-----
From: sharepointdiscussio ns@yahoogroups. com [mailto:sharepointdiscussio ns@yahoogroups. com] On Behalf Of Jay Strickland
Sent: Montag, 17. November 2008 18:45
To: sharepointdiscussio ns@yahoogroups. com
Subject: Re: [sharepointdiscussi ons] Re:convert excel formula to xsl for use in data form web part

XSLT 2.0 supports the "distinct-values" operator, but SharePoint, or more specifically SPD, does not. I have been searching and so far the only answer I have seen is "counting is the same as sorting is the same as grouping." No, it really isn't. (None of the sample solutions are really helpful, and most don't work at all.) I would have thought that counting values but excluding repeat occurrences of the value would be failrly easy. Sadly I am mistaken. If anyone has any ideas on how to simply count how many entries are in a column, excluding duplicates, I would love to know.

____________ _________ _________ __
From: Dick Penny <d_penny@usa. net>
To: sharepointdiscussio ns@yahoogroups. com
Sent: Friday, November 14, 2008 3:33:22 PM
Subject: [sharepointdiscussi ons] Re:convert excel formula to xsl for use in data form web part

I don't have an exact answer, BUT, I've seen some XSLT recipes somewhere and
thought one of them was "counting distinct items." Try the W3..org site. Or
google "XSLT recipes".

Dick Penny

[Non-text portions of this message have been removed]

------------ --------- --------- ------

Yahoo! Groups Links


[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sharepointdiscussions/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/sharepointdiscussions/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:sharepointdiscussions-digest@yahoogroups.com
mailto:sharepointdiscussions-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
sharepointdiscussions-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

0 comments: