AggregateDataSource joining ContentTypes with Lists

Feb 23, 2012 at 10:26 PM
Edited Feb 23, 2012 at 10:26 PM

I have sucessfully used in our Sharepoint 2007 internet site a RollUpDataFormWebPart in conjunction with the CrossSiteDataSource to collect data from pages based on a specific Content Type layout. Now I want to add to this Rollup data that contained in three different root level SiteCollection lists, but I am failing miserably. I have tried to employ the AggregateDataSource, but have no solution in hand.

How can I join sitecollection-wide content from a specific page layout with the root-level list data?

Here's what I am trying to do in the RollupDataFormWebPArt:

<DataSources>
	<SharePointWebControls:AggregateDataSource runat="server" IsSynchronous="false" SeparateRoot="true" id="PW_Parks1">
			<sources>

				<WebParts:CrossSiteDataSource runat="server" ContentType="RequestForClass" TopLevelSite="/" Scope="Recursive" Lists="100" FixLookups="True"  ID="ds_RequestForClass">
					<Fields>
						<FieldRef Name="Title" />
						<FieldRef Name="DisplayOnWeb" />
						<FieldRef Name="SortOrder" />
					</Fields>
					<Query>
						<Where>
							<Eq>
								<FieldRef Name='DisplayOnWeb' />
								<Value Type='Number'>1</Value>
							</Eq>
						</Where>
					</Query>
				</WebParts:CrossSiteDataSource>

				<WebParts:CrossSiteDataSource runat="server" ContentType="RequestForContentType" TopLevelSite="/" Scope="Recursive" Lists="850" DatesInISO8601="True" FixLookups="True" QueryRowLimit="100" ID="ds_RequestForContentType">
					<Fields>
						<FieldRef Name="SummaryDescription" />
						<FieldRef Name="Title" />
						<FieldRef Name="FileRef" />
						<FieldRef Name="RequestForStatus" />
						<FieldRef Name="RequestForType" />
						<FieldRef Name="RequestForClass" />
						<FieldRef Name="PublishingContactEmail" />
						<FieldRef Name="PublishingContactName" />
						<FieldRef Name="PostingDate" />
						<FieldRef Name="PublishingExpirationDate" />
						<FieldRef Name="ContractNumber" />
					</Fields>
					<Query>
						<Where>
							<Eq>
								<FieldRef Name='ContentType' />
								<Value Type='Choice'>RequestForContentType</Value>
							</Eq>
						</Where>
						<OrderBy>
							<FieldRef Name="RequestForStatus" />
						</OrderBy>
					</Query>
				</WebParts:CrossSiteDataSource>


			</sources><aggregate>
				<concat name="data source">
					<datasource name="ds_RequestForContentType" />
					<datasource id="ds_RequestForClass" />
				</concat>
			</aggregate>
		</SharePointWebControls:AggregateDataSource>
</DataSources>
Feb 23, 2012 at 10:50 PM

John

1) What is the result of using the above data source?

2) Are both sources querying the same site collection "/" or are you trying to go cross site collections?

3) Do both cross site data sources run successfully when executed independently?

4) Have you tried an aggregation while only pulling the Title field?

5) Your syntax seems a little off. Take a look at the samples here: http://portalsolutions.codeplex.com/wikipage?title=AggregateDataSource

-Pranav

Feb 23, 2012 at 10:57 PM

Thanks…I will follow up on your points. Right now SPD is pushing a nondescript error at me. My original version (see below) works, but it is not attempting to aggregate, so that is really the issue. The lists are in the same collection – they are at the root. I have not tried suggestions 3 & 4 within an AggregateDataSource. I will examine your suggestion 5 and reply back.

Thanks for your reply!

John

<WebParts:RollUpDataFormWebPart runat="server" ShowWithSampleData="False" AllowRemove="True" AllowHide="True" SuppressWebPartChrome="False" PartImageLarge="" ViewContentTypeId="" ID="g_208b6043_8502_432e_ad10_6ff561810f03" ExportMode="All" Debug="False" Dir="Default" MissingAssembly="Cannot import this Web Part." FixSorting="True" DataSourceID="" IsIncludedFilter="" DetailLink="" AllowEdit="True" UseSQLDataSourcePaging="True" HelpMode="Modeless" IsIncluded="True" Description="" FrameState="Normal" AllowConnect="True" AllowZoneChange="True" AllowMinimize="True" Title="" PartOrder="1" PageSize="-1" FrameType="Default" HelpLink="" PartImageSmall="" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" IsVisible="True" __MarkupType="vsattributemarkup" __WebPartId="{208B6043-8502-432E-AD10-6FF561810F03}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataFields>@_ListId,_ListId;@_WebId,_WebId;@_ItemId,_ItemId;@SummaryDescription,SummaryDescription;@Title,Title;@FileRef,FileRef;@RequestForStatus,RequestForStatus;@RequestForType,RequestForType;@RequestForClass,RequestForClass;@PublishingContactEmail,PublishingContactEmail;@PublishingContactName,PublishingContactName;@PostingDate,PostingDate;@PublishingExpirationDate,PublishingExpirationDate;@ContractNumber,ContractNumber;@FileRef_ID,FileRef_ID;@RequestForStatus_ID,RequestForStatus_ID;@RequestForType_ID,RequestForType_ID;@RequestForClass_ID,RequestForClass_ID;</DataFields>

<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_firstrow" Location="Postback;Connection"/>

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

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

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

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

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

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

<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="dvt_sortfield" Location="Postback;Connection"/>

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

</ParameterBindings>

<DataSources>

<WebParts:CrossSiteDataSource runat="server" ContentType="RequestForContentType" TopLevelSite="/" Scope="Recursive" Lists="850" DatesInISO8601="True" FixLookups="True" QueryRowLimit="100" ID="DSC1"><Fields><FieldRef Name="SummaryDescription" /><FieldRef Name="Title" /><FieldRef Name="FileRef" /><FieldRef Name="RequestForStatus" /><FieldRef Name="RequestForType" /><FieldRef Name="RequestForClass" /><FieldRef Name="PublishingContactEmail" /><FieldRef Name="PublishingContactName" /><FieldRef Name="PostingDate" /><FieldRef Name="PublishingExpirationDate" /><FieldRef Name="ContractNumber" /></Fields><Query>

<Where><Eq><FieldRef Name='ContentType' /><Value Type='Choice'>RequestForContentType</Value></Eq></Where><OrderBy><FieldRef Name="RequestForStatus" /></OrderBy></Query></WebParts:CrossSiteDataSource>

</DataSources>

From: epranav [email removed]
Sent: Thursday, February 23, 2012 3:51 PM
To: CHAMBERS John
Subject: Re: AggregateDataSource joining ContentTypes with Lists [portalsolutions:343924]

From: epranav

John

1) What is the result of using the above data source?

2) Are both sources querying the same site collection "/" or are you trying to go cross site collections?

3) Do both cross site data sources run successfully when executed independently?

4) Have you tried an aggregation while only pulling the Title field?

5) Your syntax seems a little off. Take a look at the samples here: http://portalsolutions.codeplex.com/wikipage?title=AggregateDataSource

-Pranav

Feb 23, 2012 at 11:02 PM

What I would do is add the webpart using the browser and configure the datasource in the browser webpart toolpane before opening it up in SPD for formatting

Feb 23, 2012 at 11:06 PM

Interesting…not my normal approach, but I’ll check that out. Why do you suggest that approach?

From: epranav [email removed]
Sent: Thursday, February 23, 2012 4:02 PM
To: CHAMBERS John
Subject: Re: AggregateDataSource joining ContentTypes with Lists [portalsolutions:343924]

From: epranav

What I would do is add the webpart using the browser and configure the datasource in the browser webpart toolpane before opening it up in SPD for formatting

Feb 23, 2012 at 11:18 PM

SPD can be quirky at times and doing it in a browser would help properly format the data source independent of any other configuration

Feb 23, 2012 at 11:21 PM

Ok…I’ll give it a try because I am definitely a witness to SPDs “quirky” behavior…I can’t believe it made it out the door @ Microsoft.

Also, I had tried to implement the ideas presented here http://portalsolutions.codeplex.com/wikipage?title=AggregateDataSource but with no success.

From: epranav [email removed]
Sent: Thursday, February 23, 2012 4:19 PM
To: CHAMBERS John
Subject: Re: AggregateDataSource joining ContentTypes with Lists [portalsolutions:343924]

From: epranav

SPD can be quirky at times and doing it in a browser would help properly format the data source independent of any other configuration

Feb 23, 2012 at 11:30 PM

Can you post the entire data source as it shows up in the browser toolpane? And the exception/error message shown in the browser when you render the page?

Feb 23, 2012 at 11:39 PM
Edited Feb 24, 2012 at 12:05 AM

I am not quite sure what you are asking so let me share this with you. I placed a RollupDFWP on a new page. I used the DataSource Editor and added

ContentType=”RequestForClass” which is the name of one of the three custom lists I want to aggregate. The content of that list is shown below, but the web page is not fetching the data.

Data Source Editor of the RollupDFWP:  

<%@ Register TagPrefix="cc1" Namespace="PS.WebParts" Assembly="PS.WebParts.Rollup, Version=12.0.0.0, Culture=neutral, PublicKeyToken=90e3045b123af1c3" %>

<cc1:CrossSiteDataSource runat="server" ContentType="RequestForClass"  TopLevelSite="/" Scope="Recursive" Lists="100" DatesInISO8601="True" FixLookups="True" QueryRowLimit="100" ID="DSC"><Fields>

<FieldRef Name="Title" /></Fields>
<Query>
</Query>
</cc1:CrossSiteDataSource>

Data from the custom list RequestForClass:

Feb 23, 2012 at 11:45 PM

John - the screenshots don't seem to have come through. Can you repost?

Feb 24, 2012 at 12:06 AM

Ok..I edited the post…images would not save so I had to play around a bit

From: epranav [email removed]
Sent: Thursday, February 23, 2012 4:45 PM
To: CHAMBERS John
Subject: Re: AggregateDataSource joining ContentTypes with Lists [portalsolutions:343924]

From: epranav

John - the screenshots don't seem to have come through. Can you repost?

Feb 24, 2012 at 12:09 AM

Is there a content type called "RequestForClass" associated with these items? It seems that you are specifying the name of the list in the ContentType attribute which wouldn't work.

Feb 24, 2012 at 3:02 PM
Edited Feb 24, 2012 at 3:13 PM

There is no RequestForClass content type, that is just the name of the custom list. I thought I had seen an example somewhere of identifying the list in that manner for a crossSiteDataSource. It's certainly not the way I am used to doing it with an spDataSource, so  this is obviously a problem.

How do I identify the list in the CrossSite, and more fundamentally, am I correct that I can aggregate data from pages based on a specific content type with data from a custom list within the RollupDFWP?

Feb 24, 2012 at 5:22 PM

There's really only two ways to target your data source. You can either do it with a content type which will look for the content type in ALL lists so usually it's beneficial to have a unique content type name. Alternatively, you can create a custom list definition with a unique base template id and then that ID can be used to target to any instances of that list definition. You can NOT target by the name or id of a list.

Feb 24, 2012 at 5:39 PM
Edited Feb 24, 2012 at 5:43 PM

When I set the CrossSiteDataSource IncludeListData="True" then I see (in debug mode)

<DocumentElement>
  <Rows>
    <_ListId>{230DB47C-2C07-4DAD-86B5-0F458F01B6A3}</_ListId>
    <_WebId>{91C7970C-EE50-4FC5-844C-41B3E242DD38}</_WebId>
    <_ItemId>1</_ItemId>
    <Title>Construction</Title>
    <_ListTitle>RequestForClass</_ListTitle>
    <_ListUrl>/Lists/RequestForClass/AllItems.aspx</_ListUrl>
    <_SiteTitle>Lane County, Oregon</_SiteTitle>
    <_SiteUrl>http://lcstage.lc100.net</_SiteUrl>
    <_ItemUrl>/Lists/RequestForClass/DispForm.aspx?ID=1</_ItemUrl>
    <_ItemEdit>/Lists/RequestForClass/EditForm.aspx?ID=1</_ItemEdit>
  </Rows>

Is there no way to use CAML in the CrossSiteDataSource <Query></Query> section to constrain the selection to my specific _ListTitle?

 

 

Feb 24, 2012 at 5:51 PM

That list data is pulled in AFTER the query has executed so it can't be used as part of the query

Feb 24, 2012 at 5:53 PM

so unfortunate.....back to the drawing board for me then. thanks for your help!

Feb 24, 2012 at 7:33 PM
Edited Feb 24, 2012 at 7:37 PM

Is it possible to use an native Sharepoint spdatasource inside RollUpDataFormWebPart <sources> </sources>? I am trying this and no errors are reported, but no rows are feteched either. I have tried "/dsQueryResponse/RequestForClass/Row" and ="/dsQueryResponse/NewDataSet/Row" to no avail.

<WebParts:RollUpDataFormWebPart runat="server" ShowWithSampleData="False" AllowRemove="True" AllowHide="True" SuppressWebPartChrome="False" PartImageLarge="" ViewContentTypeId="" ID="g_3a80fdfc_5d95_403d_89d3_ea5f20aee4b8" ExportMode="All" Debug="False" Dir="Default" MissingAssembly="Cannot import this Web Part." FixSorting="True" DataSourceID="" IsIncludedFilter="" DetailLink="" AllowEdit="True" UseSQLDataSourcePaging="True" HelpMode="Modeless" IsIncluded="True" Description="" FrameState="Normal" AllowConnect="True" AllowZoneChange="True" AllowMinimize="True" Title="" PartOrder="1" PageSize="-1" FrameType="Default" HelpLink="" PartImageSmall="" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" IsVisible="True" __MarkupType="vsattributemarkup" __WebPartId="{3A80FDFC-5D95-403D-89D3-EA5F20AEE4B8}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataFields>
</DataFields>
<ParameterBindings>
</ParameterBindings>
<DataSources>
		<SharePointWebControls:spdatasource 
			runat="server" 
			DataSourceMode="List" 
			UseInternalName="true" 
			selectcommand="<View></View>" 
			id="spdatasource2"><SelectParameters><asp:Parameter Name="ListName" DefaultValue="RequestForClass"/><asp:Parameter Name="WebURL" DefaultValue="/"/>
			</SelectParameters>			
		</SharePointWebControls:SPDataSource>
</DataSources>
<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:template match="/">
		<xsl:call-template name="dvt_1"/>
	</xsl:template>
	
	<xsl:template name="dvt_1">
		<xsl:variable name="Rows" select="/dsQueryResponse/RequestForClass/Row"/>
        <xsl:variable name="dvt_RowCount" select="count($Rows)" />
        <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
        
       	<div>dvt_RowCount: <xsl:value-of select="$dvt_RowCount" /></div>
       	<div>IsEmpty: <xsl:value-of select="$IsEmpty" /></div>
        
        <xsl:if test="$IsEmpty">No Records</xsl:if>

		<xsl:for-each select="$Rows">
			<xsl:value-of select="@Title" />
		</xsl:for-each>    

	</xsl:template>

</xsl:stylesheet>	
	</Xsl>
</WebParts:RollUpDataFormWebPart>

 

Feb 24, 2012 at 8:32 PM

You can't use a SPDataSource but what you could do is use the RollupDataSource which allows you to specify the list name with the Lists attribute.

http://portalsolutions.codeplex.com/wikipage?title=RollUpDataSource

Feb 24, 2012 at 8:43 PM

It turns out that if I use "/dsQueryResponse/Rows/Row" in the code I posted @12:33 today, I do get results returned! This is encouraging. 

My task now is to determine whether I can modify the code above by adding the AggregateDataSource to combine the data from the SPDataSource with a CrossSiteDataSource looking for a specific ContentType.

Feb 24, 2012 at 10:33 PM

The Microsoft AggregateDataSource provides a concatenation aggregation

            <Aggregate>
                <concat name="data source">
                    <datasource name="list1" id="0" Type="SPList" />
                    <datasource name="list2" id="1" Type="SPList" />
                </concat>
            </Aggregate>

However, the CodePlex AggregateDataSource does not appear to offer this same useful option. Instead one must nest <join> aggregations. This is cumbersome when trying to join numerous datasources.

Is it possibe to use the Microsoft AggregateDataSource but within its <Datasources>, use Codeplex RollUpDataSource and CrossSiteDatasources?

If yes, can you tell me what the datasource "Type" would be, which is identified as SPList in the example above. Per this entire thread, I am trying to build an xml document composed of list-based content and content derived from pages based on a specific content type.

Many thanks.

Feb 25, 2012 at 4:45 PM

The Rollup webparts only support their custom data sources. Additionally, the MS AggregateDataSource would not identify the rollup data sources as valid. Have you tried the union operation yet?

<cc1:AggregateDataSource runat="server" ID="aggDSC">

<Sources>
    (Any Rollup Data Sources)
</Sources>
<Aggregate>
     <union>
          <datasource id="DSC1" />
          <datasource id="DSC2" />
     </union>
</Aggregate>
</cc1:AggregateDataSource>