Santa Clara University

Web Publishing @ SCU

Selecting data using a filter

Some Commonspot elements include an option to select data using a "filter".  This option allows you to select one or more items from a large set of records, based on your own filter criteria.  Here's how to do that, using a filter applied to Profile element data as an example.

In this scenario, we want to select all faculty members in the Education department from the Profile element data set.  First, we'll add the Profile element to the page. You'll find this element in the Content Well element gallery category.  Click the "gear" icon to expand the element menu and select "Render Mode".

rendermode image

The two rendering mode options are to display data added to the current page, or re-use existing data added to other pages.  That's what we want here - we're going to display Profile data that was added to pages in the Education site.  Select "Display existing element data" and "Render results dynamically based on a filter".

select existing data form

Next, click the "Filter" tab at the top of the Render Mode form.

filter tab selected

Here's where we'll set the selection criteria to get profiles for Education Faculty members. The filter form lets you enter values to be matched against Profile form fields.  First, select "Show subset of records".  Then we'll select profiles in the "faculty" group, and in the "Department of Education" organization.

filter element data

NOTE: It's important to be as precise and efficient as possible when selecting data for display.  It's best to use just three or fewer fields, and use the "Equals" operator to limit the number of results returned.  If the standard profile fields aren't suitable for limiting the selection, you can add a unique tag to the individual profiles and use that in your filter.

We want to get the results returned in alphabetical order by last name, and we set that in the "Sort Order" section of this form.

sort order field

Click "OK" to complete the process ("update" will allow you to preview the selection).  The Profile element will display the full profile by default.  To switch this to a summary list, we will apply a different custom render handler.

select render handlers

Select "Custom Render Handlers" and choose "Content Well Summary Profile" from the list.  Click "next" to apply this rendering.

select summary render handler

We're done. Here's how our filtered Profile data appears:

Error in custom script module
Printer-friendly format