The AggregateDataSource is designed to combine the results of multiple data sources. The data sources can be merged and joined to create an entirely new data source.

Properties

  • ID - Unique identifier for the data source.
  • Sources - can contain 2 or more datasources to be aggregated.
  • Aggregate - this node contains instructions for aggregating specified datasources.
    • Join – will join to data sources based on the specified filter criteria.
      • Left – Contains the id of the cross site data source that should be processed on the left.
      • Right – Contains the id of the cross site data source that should be processed on the left.
      • On – Sets the criteria to use in the joining operation
      • Type – the type of join to performs.
        • Inner – Returns all rows that match the criteria in both data sources.
        • Left – Returns all the rows in the left data source as well as any rows in the right data source that match the criteria.
        • Right – Returns all the rows in the right data source as well as any rows in the left data source that match the criteria.
    • Union – Will merge the data sources into a single larger data source. Must contain a list of data sources along with their respective ids.

Sample Configuration

Example below illustrates two CrossSiteDatasource (Sandboxed)s being joined on WebID columns
<AggregateDataSource ID="aggDSC">
<Sources>
     <CrossSiteDataSource Scope="Recursive" DatesInISO8601="True" FixLookups="True" Lists="100" QueryRowLimit="1" ContentType="Project Info" ID="DSC1" IncludeListData="False" TopLevelSite=".">
<Fields>
     <FieldRef Name="ProjectName" />
</Fields>
<Query />
</CrossSiteDataSource>

<CrossSiteDataSource Scope="Recursive" DatesInISO8601="True" FixLookups="True" Lists="100" QueryRowLimit="1000" ContentType="Consultant" ID="DSC2" IncludeListData="False" TopLevelSite=".">
<Fields>
     <FieldRef Name="ConsultantName" />
     <FieldRef Name="Rate" />
</Fields>
<Query>
     <Where>
     <Eq>
          <FieldRef Name="IsActive" />
          <Value Type="Text">Yes</Value>
     </Eq>
     </Where>
</Query>
</CrossSiteDataSource>
</Sources>

<Aggregate>
     <join left="DSC2" right="DSC1" on="_WebID=_WebID" Type="Inner"></join>
</Aggregate>

</AggregateDataSource>

Example bellow illustrates a union operation
<AggregateDataSource ID="aggDSC">

<Sources>
    (Any Data Sources….)
</Sources>
<Aggregate>
     <union>
          <datasource id="DSC1" />
          <datasource id="DSC2" />
     </union>
</Aggregate>
</AggregateDataSource>

Example below shows aggregating 3 lists. Suppose we have a list of Countries, States and Cities. States and Cities lists contain a lookup column to the parent list. We use that lookup column to perform nested inner join.

<AggregateDataSource ID="aggDSC">
<Sources>

    <CrossSiteDataSource ContentType="Country" TopLevelSite="." Scope="Web" IncludeListData="False"  Lists="100" QueryRowLimit="10" ID="dsCountry">
        <Fields>
            <FieldRef Name="Title" Alias="Country" />
        </Fields>
        <Query/>
    </CrossSiteDataSource>

    <CrossSiteDataSource ContentType="State" TopLevelSite="." Scope="Web" FixLookups="True" IncludeListData="False"  Lists="100" QueryRowLimit="10" ID="dsState">
        <Fields>
            <FieldRef Name="Title" Alias="State" />
            <FieldRef Name="Country" />
        </Fields>
        <Query/>
    </CrossSiteDataSource>

    <CrossSiteDataSource ContentType="City" TopLevelSite="." Scope="Web" FixLookups="True" IncludeListData="False"  Lists="100" QueryRowLimit="10" ID="dsCity">
        <Fields>
            <FieldRef Name="Title" Alias="City" />
            <FieldRef Name="State" />
        </Fields>
        <Query/>
    </CrossSiteDataSource>

</Sources>

<Aggregate>
    <join left="dsCountry" right="dsState" on="Country=Country" Type="Inner">
         <!-- only 'right' datasource may be specified for nested joins. 'left' is assumed to be the parent -->
        <join right="dsCity" on="State=State" Type="Inner" />
    </join>
</Aggregate>

</cc1:AggregateDataSource>

Result XML:
<NewDataSet>
  <Rows>
    <_ListId>D8F636DF-D179-4251-9361-291184AA7EE6</_ListId>
    <_WebId>1AE61265-2FE5-42F8-B29A-21C890618794</_WebId>
    <_ItemId>1</_ItemId>
    <Country>United States</Country>
	
    <_ListId_1>09FF1A82-CE64-4024-8EA9-07BA9AE18319</_ListId_1>
    <_WebId_1>1AE61265-2FE5-42F8-B29A-21C890618794</_WebId_1>
    <_ItemId_1>1</_ItemId_1>
    <State>Maryland</State>
    <Country_1>United States</Country_1>
    <Country_ID>1</Country_ID>
	
    <_ListId_2>70FB212A-8B83-4D0C-ACD7-CF3A4E29A74D</_ListId_2>
    <_WebId_2>1AE61265-2FE5-42F8-B29A-21C890618794</_WebId_2>
    <_ItemId_2>1</_ItemId_2>
    <City>Rockville</City>
    <State_1>Maryland</State_1>
    <State_ID>1</State_ID>
  </Rows>
</NewDataSet>

Last edited Jul 7, 2011 at 8:39 AM by fildalex, version 3

Comments

No comments yet.