US : +1 941 312-2326
UK : +44 (0)207 127 4516
Email : support@lightningtools.com

How the Lightning Conductor Web Part Improves the CQWP

Lightning Conductor Web Part vs Content Query Web Part

The Lightning Conductor Web Part is used by many of our customers as it overcomes some of the limitations in the Out-of-the-Box roll up web part by Microsoft.  The Microsoft Content Query Web Part (CQWP) is extremely powerful, and is also very efficient due to the clever things that Microsoft did with the caching for this web part.  What we hope to do in this article is explain when to use the CQWP, and when to use the Lightning Conductor Web Part and point out the benefits of both products within your environments.

The Content Query Web Part

The Content Query Web Part (CQWP) also known as ‘Content By Query Web Part’ is available with MOSS and MOSS Enterprise and provides you with the ability to roll up SharePoint list items from within a site collection.

The Query Options

The CQWP provides you with three different options for querying your content.  It allows you to include lists and libraries from anywhere in the current site collection, or choose the option to include a specific site and all of its subsite, and alternatively you can point it at a specific list. Figure 1 displays the options available to you for the query which includes:
• Show items from all sites in this site collection
• Show items from the following site and all subsites
• Show items from the following list

The query source options in the CQWP
 
Figure 1 – The query source options in the CQWP

The List Type Section

The web part allows you to select the content to be aggregated based upon some simple criteria such as list type or content type.  Child content types can also be selected which allows any custom content types that you have created to also be returned with the results.  Selecting the content type is very useful if you do not wish to rollup for example ‘All Documents’ but you wish to roll up ‘All Documents’ that were created with the ‘Proposal’ content type.

The selection criteria of the CQWP
 
Figure 2 – The selection criteria of the CQWP

Once the query type has been set, you may want to filter the results e.g. Roll up all Proposals that were created in the last 30 days.  The CQWP allows you to do this easily by setting the filter options.  You can select any of the standard columns from the list or content type and then provide an operator and filter value to trim your results.  Up to 3 filter conditions can be applied with an And/Or statement between them which is usually enough for most requirements.  Figure 3 displays the filter options.

The filter options in the CQWP
 
Figure 3 – The filter options in the CQWP

The filter options provide you with a list of ‘Standard’ columns from each list or content type in alphabetical order which makes it easier to find them from the extensive list.   Custom columns or custom site columns are not included for the purpose of filtering as shown below in Figure 4.

The field selection drop down box in the CQWP

Figure 4 – The field selection drop down box in the CQWP

Audience Targeting

You will notice that in Figure 3, there was also an audience targeting option.  The audience targeting needs to be turned on in each instance of a list where an audience should be targeted.  An example of audience targeting is that only certain content should be displayed to certain categories of people.  This is not security but a way of limiting the overwhelming results that could be displayed in the CQWP.  If we take announcments as an example, there are many announcements made in a company everyday that do not affect certain individuals.  So, if I am not based out of the ‘New York’ office, I would not be interested in an announcement of a ‘Fire Drill’ taking place in the ‘New York’ office at 11am today.  Therefore such an announcement can be targeted to just the ‘New York’ office audience.  As each user visits the SharePoint page that contains the CQWP, the currently logged on users audiences are checked against the results and therefore filtered.

Presentation

The Content Query Web Part also allows you to customize the way that the results are displayed. The default is for the CQWP to display the title field of each item in the results.  This title field is a hyperlink to the list or document.  To display other columns, you will need to customize the XSL for the web part allowing you to select other ‘standard’ columns.
Figure 5 displays the options available to you allowing grouping, sorting, set the number of columns e.g. the table columns in the results, and also any styles.

The Presentation Options in the CQWP

Figure 5 – The Presentation Options in the CQWP

The available styles are provided by a number of XSL files within a style library which is available with MOSS.  The style library will be found at the top level site within your site collection.  It is possible to copy, and change the styles by manually modifying the XSL.  The reason for doing so would include the ability to add more columns than just the title column. Figure 6 displays an example of the XSL file and points out the title column.  This code can be copied and modified for each column that you wish to modify.

The ItemStyle.xsl file found in the Style Library>

Figure 6 – The ItemStyle.xsl file found in the Style Library

The Content Query Web Part performs extremely well within the site collection it rolls up from.  This is mainly due to complex caching that can be configured via the site collection administration settings under the option of ‘Object Cache Settings’.  This goes way beyond the usual web part caching that is performed by most web part developers.  Figure 7 displays the cross list query cache settings that effect the CQWP performance.

The Cross List Query Cache 

Options
 
Figure 7 – The Cross List Query Cache Options

Summary of the Content Query Web Part

The CQWP is a very powerful tool for content aggregation and its main plus point is the performance when returning the results.  The downside is that the web part is difficult to configure and involves writing custom XSL if you wish to display anything other than the title field.  The web part will also only roll up from a single site collection meaning that if you follow the SharePoint best practice of having multiple site collections, you will not be able to rollup your content with this web part.  The web part will also only work in a MOSS or MOSS Enterprise environment and therefore does not offer any form of roll up for Windows SharePoint Services customers who wish to aggregate content.

Lightning Conductor Web Part

The Lightning Conductor Web Part was developed originally with two problems in mind.  It was our intention to solve the CQWP issues using a web part that was still intuitive to use, still performed well, but also was capable of aggregating across multiple site collections whilst offering the ability to easily display columns other than the title column and to also include custom columns for display and filtering purposes.

The Query Options

The query options in the Lightning Conductor Web Part allow you to select from several criteria which are shown in Figure 8.

The LCWP Source options
 
Figure 8 – The LCWP Source options

You can choose the option to ‘Show items from all site collections’.  Once configured with filtering and list types, the web part will query the list type or content type from every site in every site collection within the current web application.  This means that as new site collections are created, the LCWP will not require reconfiguring to include the newly created sites or site collections.  The second option is to aggregate from multiple site collections. This option allows you to specify which site collections within the web application should be included in the results.

Displays the multiple site collection option selected
 
Figure 9 – Displays the multiple site collection option selected

Of course, you may even want to be selective about specific sites or specific lists to be included within the results.  The third and fourth options allow this to be possible providing you with a hierarchical view of the site collections, sites and lists along with a check box for each as is shown below in Figure 10.

The LCWP providing you with the ability to select or deselect specific lists to show in the results.
 
Figure 10 – The LCWP providing you with the ability to select or deselect specific lists to show in the results.

The List Type Section

The list type section is virtually the same as the CQWP.  You can select from the list type or content type and also include child content types. Figure 11 displays the list type selection section of the LCWP toolpane.

The list type or content type section of the tool pane.

Figure 11 – The list type or content type section of the tool pane.

Once you have selected the list type or content type, you can move onto the filtering options.  The LCWP provides you with the ability to filter via the toolpane (for site admins) or to filter via the web part itself using a quick filter toolbar.  The site administrator can decide if the quick filters toolbar should be displayed or not.  The filters in the LCWP also include the ability to add unlimited conditions with And/Or statements along with the ability to filter on custom columns and custom site columns.  Figure 12 shows the filter options in the LCWP.

The filter options in the LCWP
 
Figure 12 – The filter options in the LCWP

The user experience of the web part for filtering is very intuitive.  You can see below in Figure 13 the quick filter toolbar in place for the user:

The quick filter toolbar in the LCWP
 
Figure 13 – The quick filter toolbar in the LCWP

Another filtering option also exists which offers very powerful scenarios and that is the ability to filter via the MOSS Enterprise filter web parts such as the current user filter or the current date filter.  The LCWP can receive filter conditions from virtually anywhere.  Below you can see the LCWP connected to the current user filter web part allowing the currently logged on username to be passed to the LCWP’s 'Assigned To' field when rolling up task items.  The results are then filtered for the currently logged on user.

The LCWP connected to one of the MOSS Enterprise 

filter web parts
 
Figure 14 – The LCWP connected to one of the MOSS Enterprise filter web parts

Audience Targeting

As well as filtering the results using standard filters, just like in the CQWP, results can be filtered on an audience basis.  The audience targeting is a MOSS only feature and therefore this option is disabled for Windows SharePoint Services (WSS) users.  We have offered a single improvement here allowing the audience used to be selected as is shown below in Figure 15.

Displays the audience targeting options for the 

LCWP
 
Figure 15 – Displays the audience targeting options for the LCWP

Presentation

The Lightning Conductor Web Part provides presentation options for two types of users.  Non-programmers can build the view using a point and click toolpane where columns, sorting options, hyperlinks etc can be set simply by clicking checkboxes.  Figure 16 displays the view selection criteria. Highlighted is a custom column demonstrating that custom columns can be included in the results.

The view selection tool pane.
 
Figure 16 – The view selection tool pane.

Even for WSS users, if you do not have a style library, one can be created allowing you to upload custom XSL files into the style library for use in the web part.  You can see these options below in Figure 17

The XSL style view options
 
Figure 17 – The XSL style view options

In the circumstance that you really want to customize the look and feel, we provide you with the ability to customize by creating custom XSL files.  Even if you are creating a custom XSL file, we provide you with a huge headstart by being able to view the XSL that is already created using your filter and selection criteria.  The XSL can then be copied and modified to suit your exact requirements.  Below is a example of a customized XSL File being displayed along with results.

A custom XSL style with document icons, meta data, sorting, and paging 

set.
 
Figure 18 – A custom XSL style with document icons, meta data, sorting, and paging set.

Summary

The Lightning Conductor Web Part performs very well even across multiple site collections and can be configured within minutes even by a non developer allowing for extra time to be spent on other parts of your SharePoint project.  The LCWP also offers very powerful filtering options including filtering from other web parts and the quick filter toolbar, it allows for easy selection of columns via a 'View Selection' toolpane, and of course can aggregate from multiple site collections.
We are often asked about whether the web part can aggregate from multiple web applications. Currently this is not the case, but we will soon be posting an article on how that can be achieved using the SharePoint Designer Data View Web Part and the Lists.asmx web service.