Filtering in Linked Sources using the QueryString as paramters in CAML(Select Command) and not XSLT filtering

Vamsi
  • Filtering in Linked Sources using the QueryString as paramters in CAML(Select Command) and not XSLT filtering Vamsi

    Did anybody tried Filtering Linked Data Sources using the QueryString as paramters in CAML (Select Command) and not XSLT filters

    AggregateDataSource with Parameter

    <DataSources><SharePointWebControls:AggregateDataSource runat="server" IsSynchronous="false" SeparateRoot="true" id="New_x0020_Data_x0020_Source1"><sources><SharePointWebControls:spdatasource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;Value Type=&quot;Counter&quot;&gt;{ID}&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;PublishedDate&quot; Ascending=&quot;FALSE&quot;/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name=&quot;ContentTypeId&quot;/&gt;&lt;FieldRef Name=&quot;Title&quot;/&gt;&lt;FieldRef Name=&quot;_ModerationComments&quot;/&gt;&lt;FieldRef Name=&quot;File_x0020_Type&quot;/&gt;&lt;FieldRef Name=&quot;Body&quot;/&gt;&lt;FieldRef Name=&quot;NumComments&quot;/&gt;&lt;FieldRef Name=&quot;PostCategory&quot;/&gt;&lt;FieldRef Name=&quot;PublishedDate&quot;/&gt;&lt;FieldRef Name=&quot;_ModerationStatus&quot;/&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;FieldRef Name=&quot;ContentType&quot;/&gt;&lt;FieldRef Name=&quot;Modified&quot;/&gt;&lt;FieldRef Name=&quot;Created&quot;/&gt;&lt;FieldRef Name=&quot;Author&quot;/&gt;&lt;FieldRef Name=&quot;Editor&quot;/&gt;&lt;FieldRef Name=&quot;_HasCopyDestinations&quot;/&gt;&lt;FieldRef Name=&quot;_CopySource&quot;/&gt;&lt;FieldRef Name=&quot;_UIVersion&quot;/&gt;&lt;FieldRef Name=&quot;_UIVersionString&quot;/&gt;&lt;FieldRef Name=&quot;Attachments&quot;/&gt;&lt;FieldRef Name=&quot;FileRef&quot;/&gt;&lt;FieldRef Name=&quot;FileDirRef&quot;/&gt;&lt;FieldRef Name=&quot;Created_x0020_Date&quot;/&gt;&lt;FieldRef Name=&quot;FSObjType&quot;/&gt;&lt;FieldRef Name=&quot;FileLeafRef&quot;/&gt;&lt;FieldRef Name=&quot;PermMask&quot;/&gt;&lt;/ViewFields&gt;&lt;/View&gt;"><SelectParameters><asp:Parameter Name="ListID" DefaultValue="5A97A2C9-5609-47DE-A259-9DF3CCD3BB7D"/></SelectParameters><DeleteParameters><asp:Parameter Name="ListID" DefaultValue="5A97A2C9-5609-47DE-A259-9DF3CCD3BB7D"/></DeleteParameters><UpdateParameters><asp:Parameter Name="ListID" DefaultValue="5A97A2C9-5609-47DE-A259-9DF3CCD3BB7D"/></UpdateParameters><InsertParameters><asp:Parameter Name="ListID" DefaultValue="5A97A2C9-5609-47DE-A259-9DF3CCD3BB7D"/></InsertParameters></SharePointWebControls:spdatasource><SharePointWebControls:spdatasource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;_ModerationStatus&quot;/&gt;&lt;Value Type=&quot;Text&quot;&gt;Approved&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;Created&quot; Ascending=&quot;FALSE&quot;/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name=&quot;ContentTypeId&quot;/&gt;&lt;FieldRef Name=&quot;Title&quot;/&gt;&lt;FieldRef Name=&quot;_ModerationComments&quot;/&gt;&lt;FieldRef Name=&quot;File_x0020_Type&quot;/&gt;&lt;FieldRef Name=&quot;Body&quot;/&gt;&lt;FieldRef Name=&quot;PostTitle&quot;/&gt;&lt;FieldRef Name=&quot;PostID&quot;/&gt;&lt;FieldRef Name=&quot;_ModerationStatus&quot;/&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;FieldRef Name=&quot;ContentType&quot;/&gt;&lt;FieldRef Name=&quot;Modified&quot;/&gt;&lt;FieldRef Name=&quot;Created&quot;/&gt;&lt;FieldRef Name=&quot;Author&quot;/&gt;&lt;FieldRef Name=&quot;Editor&quot;/&gt;&lt;FieldRef Name=&quot;_HasCopyDestinations&quot;/&gt;&lt;FieldRef Name=&quot;_CopySource&quot;/&gt;&lt;FieldRef Name=&quot;_UIVersion&quot;/&gt;&lt;FieldRef Name=&quot;_UIVersionString&quot;/&gt;&lt;FieldRef Name=&quot;Attachments&quot;/&gt;&lt;FieldRef Name=&quot;FileRef&quot;/&gt;&lt;FieldRef Name=&quot;FileDirRef&quot;/&gt;&lt;FieldRef Name=&quot;Created_x0020_Date&quot;/&gt;&lt;FieldRef Name=&quot;FSObjType&quot;/&gt;&lt;FieldRef Name=&quot;FileLeafRef&quot;/&gt;&lt;FieldRef Name=&quot;PermMask&quot;/&gt;&lt;/ViewFields&gt;&lt;/View&gt;"><SelectParameters><asp:Parameter Name="ListID" DefaultValue="C5635ED3-F6B9-48B3-9A79-1C2B5C256701"/></SelectParameters><DeleteParameters><asp:Parameter Name="ListID" DefaultValue="C5635ED3-F6B9-48B3-9A79-1C2B5C256701"/></DeleteParameters><UpdateParameters><asp:Parameter Name="ListID" DefaultValue="C5635ED3-F6B9-48B3-9A79-1C2B5C256701"/></UpdateParameters><InsertParameters><asp:Parameter Name="ListID" DefaultValue="C5635ED3-F6B9-48B3-9A79-1C2B5C256701"/></InsertParameters></SharePointWebControls:spdatasource></sources><aggregate><concat name="data source"><datasource name="Posts" id="0" Type="SPList"/><datasource name="Comments" id="1" Type="SPList"/></concat></aggregate></SharePointWebControls:AggregateDataSource></DataSources>
    

    Parameter Bindings

    <ParameterBindings><ParameterBinding Name="dvt_apos" Location="Postback;Connection"/><ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/><ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/><ParameterBinding Name="ID" Location="QueryString(ID)" DefaultValue="1"/></ParameterBindings>
    

  • You can use the values of Query String parameters by setting up parameters in your DVWP and then using those values in your filters. The net effect of this is to alter the CAML to contain the filtering.

    Creation of each parameter will create a line in the ParameterBindings section like this:

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

    You can then use that value in your CAML, something like this:

    selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;Value Type=&quot;Counter&quot;&gt;{ID}&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;"
    

Tags
data-view-web-part 2007
Related questions and answers
  • ;DataSources> &lt;SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" UseInternalName="true" selectcommand="&amp;lt;View&gt;&amp;lt;ViewFields&gt;&amp;lt;FieldRef Name=&amp;quot;ID&quot;/&amp;gt;&amp;lt;FieldRef Name=&amp;quot;PermMask&quot;/&amp;gt;&amp;lt;/ViewFields&gt;&amp;lt;/View&gt;" id="SPDataSource2"&gt;&lt;SelectParameters>&lt...="QueryString(ID)" DefaultValue="0"/&gt; &lt;ParameterBinding Name="ListName" Location="QueryString(List)" DefaultValue=""/&gt; &lt;/ParameterBindings> &lt;datafields>@Title,Title;@Priority

  • is coming back, but the ListProperty.Description value isn't; it's always blank. Here's the CAML and the datafields declaration I'm using: &lt;DataSources>&lt;SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" UseInternalName="true" selectcommand="&amp;lt;View&gt;&amp;lt;Webs Scope=&amp;quot;Recursive&quot;&amp;gt;&amp;lt;/Webs&gt;&amp;lt;Lists ServerTemplate=&amp;quot;109&amp;quot;&amp;gt;&amp;lt;/Lists&gt;&amp;lt;ViewFields&gt;&amp;lt;ListProperty Name=&amp;quot;Title&quot;/&amp;gt;&amp;lt;ListProperty Name=&amp;quot;Description&quot;/&amp;gt

  • contains a hyperlink. My CAML render pattern looks like: &lt;RenderPattern Name="DisplayPattern"&gt; &lt;Switch> &lt;Expr> &lt;Column /&gt; &lt;/Expr> &lt;Case Value...="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"&gt; &lt;xsl:template match="FieldRef[@FieldType='DataLinkUrl']" mode="Note_body"&gt; &lt;xsl:param name="thisNode" select="."/&gt; &lt;xsl:variable name="url"&gt; &lt;xsl:value-of select="substring-before(substring-after(substring-after($thisNode/@*[name()=current()/@Name],';#'),';#'),';#')"/&gt; &lt;/xsl:variable> &lt

  • ; &lt;FieldRef Name="ID" /&gt; &lt;!-- Field which do not return values --&gt; &lt;FieldRef Name="Responsible" Nullable="TRUE" Type="UserMulti" /&gt; &lt;FieldRef Name="Accountable" Nullable="TRUE" Type="UserMulti" /&gt; &lt;!-- // Field which do not return values --&gt; &lt;ProjectProperty Name="Title" /&gt; &lt;/ViewFields> &lt;/View> &lt;Query> &lt;OrderBy> &lt;ProjectProperty Name="Title" Ascending="TRUE" /&gt; &lt;FieldRef Name="Title" Ascending="TRUE" /&gt; &lt;/OrderBy> &lt;/Query> &lt;/View> I'm trying

  • ;/Webs> &lt;View> &lt;ViewFields> &lt;FieldRef Name="Development_x0020_Status" /&gt; &lt;FieldRef Name="Title" /&gt; &lt;FieldRef Name="FileDirRef" /&gt; &lt;FieldRef Name="ID" /&gt; &lt;FieldRef Name="StreamName" /&gt; &lt;/ViewFields> &lt;/View> &lt;Query> &lt;OrderBy> &lt;FieldRef Name="StreamName" Ascending="TRUE" /&gt; &lt;FieldRef Name="Title" Ascending="TRUE" /&gt; &lt;/OrderBy> &lt;/Query> &lt;/View> One of the things i would now

  • (LeafControl.OnMouseOver(this, event));&quot; onmouseout=&quot;return (LeafControl.OnMouseOut(this, event));&quot;&gt;&lt;SPAN id=V1_I1_CP2_SignIcon&gt;&lt;/SPAN>&lt;SPAN id=V1_I1_CP2_ErrorTip&gt... (ContactPicker.OnEditBoxMouseDown(this, event));&quot; maxHeight=&quot;60&quot;&gt;&lt;SPAN class=recipientResolvedUser tabIndex=-1 contentEditable=false ownerid=&quot;V1_I1_CP2&quot; displayname=&quot;John Doe" objectid=&quot;CONTOSO\sdja" objecttype=&quot;1&quot; realname=&quot;Djaarbekov Stanislav M.&quot; orgindex=&quot;0&quot;&gt;&lt;SPAN tabIndex=-1 contentEditable=true>Doe 

  • Hiding Left Nav user1155

    ;asp:ContentPlaceHolder id="PlaceHolderNavSpacer" runat="server" /&gt; &lt;div id="s4-leftpanel" class="s4-notdlg"&gt; &lt;div id="s4-leftpanel-content"&gt; &lt;asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server" /&gt; &lt;asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server" /&gt; &lt;asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server"&gt;&lt;/asp:ContentPlaceHolder> &lt;asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop

  • tilbagelagt = &lt;/xsl:text> &lt;xsl:call-template name="xsum"&gt; &lt;xsl:with-param name="currnode" select="//Row[1]"/&gt; &lt;xsl:with-param name="attr-type..."/&gt; &lt;xsl:value-of select="sum($Rows/@Distance[.!=''])" /&gt; &lt;/xsl:template> &lt;/xsl:stylesheet> The result is: "NaN", so I figure that my XSLT is wrong. Question.../@Distance[1]"/&gt;&lt;/xsl:call-template> &lt;xsl:template name="xsum"&gt; &lt;xsl:param name="currnode"/&gt; &lt;xsl:param name="res" select="0"/&gt; &lt;xsl

  • ; &lt;asp:Parameter Name="Domain" Type="String" /&gt; &lt;asp:Parameter Name="code" Type="String" /&gt; &lt;asp:Parameter Name="meaning" Type="String" /&gt; &lt;asp:Parameter Name="enabled" Type="Int32" /&gt; &lt;asp:Parameter Name="Link" Type="String" /&gt; &lt;/InsertParameters> &lt;/asp:ObjectDataSource> The dropdownlist using the above datasource is: &lt;asp... in the TypeName property of ObjectDataSource 'ObjectDataSource2' could not be found The relevant 'ObjectDataSource2' in the ascx file has this code: &lt;asp:ObjectDataSource ID="ObjectDataSource2" runat

Data information