0

I have a list named "PendingApproval" in SharePoint 2016 on-premises. When the user login in to the system then in the home page I have to show total Pending Approval request for this loggedin user. I have to filter this by RequestedBy column which is Person type column. In SharePoint Designer I can filter the data by "RequestedBy" column but I am unable to get Total Number of request/count. How can I do this with SharePoint Designer 2013.

I have tried with Data View & Display Item form. I have used <xsl:value-of select="count($RequestedBy)" /> but nothing is coming.

Let's say there are 3 request for user SP1 in PendingApproval list, so the output will the 3

My Code:

<WebPartPages:DataFormWebPart runat="server" IsIncluded="True" AsyncRefresh="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="8" Title="PendingApproval" PageType="PAGE_NORMALVIEW" ListName="{958ED955-7861-4A22-A727-4EC48F4BBC56}" Default="FALSE" DisplayName="PendingApproval" __markuptype="vsattributemarkup" __WebPartId="{534BCC5E-21EF-46D2-B4A8-29803F4A8224}" id="g_534bcc5e_21ef_46d2_b4a8_29803f4a8224" pagesize="1" __AllowXSLTEditing="true" WebPart="true" Height="" Width="">
    <DataSources>
        <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="true" selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;RequestedBy&quot;/&gt;&lt;Value Type=&quot;Integer&quot;&gt;&lt;UserID/&gt;&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" id="PendingApproval1"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{958ED955-7861-4A22-A727-4EC48F4BBC56}"/><asp:Parameter Name="StartRowIndex" DefaultValue="0"/><asp:Parameter Name="nextpagedata" DefaultValue="0"/><asp:Parameter Name="MaximumRows" DefaultValue="1"/></SelectParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{958ED955-7861-4A22-A727-4EC48F4BBC56}"/></DeleteParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{958ED955-7861-4A22-A727-4EC48F4BBC56}"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{958ED955-7861-4A22-A727-4EC48F4BBC56}"/></InsertParameters></SharePoint:SPDataSource>
    </DataSources>
    <ParameterBindings>
                                <ParameterBinding Name="ListID" Location="None" DefaultValue="{958ED955-7861-4A22-A727-4EC48F4BBC56}"/>
                                <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
                                <ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/>
                                <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
                                <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
                                <ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
                                <ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
                                <ParameterBinding Name="dvt_nextpagedata" Location="Postback;Connection"/>
                            </ParameterBindings>
    <datafields>@Title,Title;@ProcessName,ProcessName;@RequestedBy,RequestedBy;@RequestedByName,RequestedByName;@RequestDate,RequestDate;@StatusAtMyTask,StatusAtMyTask;@RequestID,RequestID;@EmployeeID,EmployeeID;@RequestedByEmail,RequestedByEmail;@RequestLink,RequestLink;@IsOverdue,IsOverdue;@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;@ItemChildCount,Item Child Count;@FolderChildCount,Folder Child Count;@AppAuthor,App Created By;@AppEditor,App Modified By;</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=""/>
    <xsl:param name="dvt_apos">'</xsl:param>
    <xsl:param name="ManualRefresh"></xsl:param>
    <xsl:param name="dvt_firstrow">1</xsl:param>
    <xsl:param name="dvt_nextpagedata" />
    <xsl:param name="UserID">CurrentUserName</xsl:param>
    <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:choose>
            <xsl:when test="($ManualRefresh = 'True')">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="top">
                            <xsl:call-template name="dvt_1"/>
                        </td>
                        <td width="1%" class="ms-vb" valign="top">
                            <img src="/_layouts/15/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>
                        </td>
                    </tr>
                </table>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="dvt_1"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="dvt_1">
        <xsl:variable name="dvt_StyleName">RepForm3</xsl:variable>
        <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
        <xsl:variable name="dvt_RowCount" select="count($Rows)"/>
        <xsl:variable name="RowLimit" select="1" />
        <xsl:variable name="FirstRow" select="$dvt_firstrow" />
        <xsl:variable name="LastRow" select="$FirstRow + $dvt_RowCount - 1" />
        <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
        <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>

        <xsl:choose>
            <xsl:when test="$dvt_IsEmpty">
                <xsl:call-template name="dvt_1.empty"/>
            </xsl:when>
            <xsl:otherwise>
                <table border="0" width="100%">
                    <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:call-template name="dvt_1.commandfooter">
            <xsl:with-param name="FirstRow" select="$FirstRow" />
            <xsl:with-param name="LastRow" select="$LastRow" />
            <xsl:with-param name="RowLimit" select="$RowLimit" />
            <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
            <xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />
        </xsl:call-template>
    </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:variable name="dvt_KeepItemsTogether" select="false()" />
            <xsl:variable name="dvt_HideGroupDetail" select="false()" />
            <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">
                <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
                    <xsl:call-template name="dvt_1.rowview" />
                </xsl:if>
            </xsl:if>
        </xsl:for-each>

    </xsl:template>
    <xsl:template name="dvt_1.rowview">
        <tr>
            <td>
                <table border="0" cellspacing="0" width="100%">
                    <tr>
                        <td width="25%" class="ms-vb">
                            <b>RequestedBy:</b>
                        </td>
                        <td width="75%" class="ms-vb">
                            <xsl:value-of select="@RequestedBy" disable-output-escaping="yes" />
                        </td></tr><tr>
                        <td width="25%" class="ms-vb">
                            <b>count(@RequestedBy):</b>
                        </td>
                        <td width="75%" class="ms-vb">

                            <xsl:variable name="count" select="count(@RequestedBy)" />

                        </td></tr>
                    <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
                        <tr>
                            <td colspan="99" class="ms-vb">
                                <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
                            </td>
                        </tr>
                    </xsl:if>
                </table>
            </td>
        </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>
    <xsl:template name="dvt_1.commandfooter">
        <xsl:param name="FirstRow" />
        <xsl:param name="LastRow" />
        <xsl:param name="RowLimit" />
        <xsl:param name="dvt_RowCount" />
        <xsl:param name="RealLastRow" />
        <table cellspacing="0" cellpadding="4" border="0" width="100%">
            <tr>
                <xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata">
                    <xsl:call-template name="dvt_1.navigation">
                        <xsl:with-param name="FirstRow" select="$FirstRow" />
                        <xsl:with-param name="LastRow" select="$LastRow" />
                        <xsl:with-param name="RowLimit" select="$RowLimit" />
                        <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                        <xsl:with-param name="RealLastRow" select="$RealLastRow" />
                    </xsl:call-template>
                </xsl:if>
            </tr>
        </table>
    </xsl:template>
    <xsl:template name="dvt_1.navigation">
        <xsl:param name="FirstRow" />
        <xsl:param name="LastRow" />
        <xsl:param name="RowLimit" />
        <xsl:param name="dvt_RowCount" />
        <xsl:param name="RealLastRow" />
        <xsl:variable name="PrevRow">
            <xsl:choose>
                <xsl:when test="$FirstRow - $RowLimit &lt; 1">1</xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$FirstRow - $RowLimit" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="LastRowValue">
            <xsl:choose>
                <xsl:when test="$LastRow &gt; $RealLastRow">
                    <xsl:value-of select="$LastRow"></xsl:value-of>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$RealLastRow"></xsl:value-of>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="NextRow">
            <xsl:value-of select="$LastRowValue + 1"></xsl:value-of>
        </xsl:variable>
        <td nowrap="nowrap" class="ms-paging" align="right">
            <xsl:if test="$dvt_firstrow &gt; 1" ddwrt:cf_ignore="1">
                <a>
                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={1};dvt_startposition={}')" />;</xsl:attribute>
                Start</a>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                <a>
                <xsl:attribute name="href">javascript: history.back();</xsl:attribute>
                <img src="/_layouts/15/images/prev.gif" border="0" alt="Previous" />
                </a>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            </xsl:if>
            <xsl:value-of select="$FirstRow" />
             - <xsl:value-of select="$LastRowValue" />
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>

            <xsl:if test="$LastRowValue &lt; $dvt_RowCount or string-length($dvt_nextpagedata)!=0" ddwrt:cf_ignore="1">
                <a>
                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$NextRow,'};dvt_startposition={',$dvt_nextpagedata,'}'))" />;</xsl:attribute>
                <img src="/_layouts/15/images/next.gif" border="0" alt="Next" />
                </a>
            </xsl:if>
        </td>
    </xsl:template>
</xsl:stylesheet>   </XSL>
</WebPartPages:DataFormWebPart>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.