---
schema_version: "1"
id: 863ab6b94e6aa4ef2aeca972db041d8f3746ba03ff97c8a15be896b90caaa84f
title: Data Filter Examples
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/siteforce_data_repeater_examples.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.siteforce_data_repeater_examples.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: cacda58b20b9ea8066f7ae86257c686bfb21128d87539683312934d98810d7ad
description: When working with data repeaters, data tables, and data functions, you can filter the data you retrieve in many ways. In this topic, we explore two options— fixed values and URL query strings—to illustrate some common filtering techniques.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Data Filter Examples

When working with data repeaters, data tables, and data functions, you can filter the data you retrieve in many ways. In this topic, we explore two options— fixed values and URL query strings—to illustrate some common filtering techniques.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col>
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <p>Available for purchase in: <strong>Enterprise</strong>, <strong>Performance</strong>,
                and <strong>Unlimited</strong> Editions</p>
              <p style="margin-bottom:0;">Available (with limitations) in:
                <strong>Developer</strong> Edition
              </p>
            </td>

          </tr>
        </tbody>
      </table>

Example 1: Use a Fixed Value to Filter Results

In our first example, we have a custom object called “News” that stores company news and events. Each news item has a Status picklist that can be set to either In Progress or Approved. We only want to display approved news items on our Company News page. In this case, we can use a fixed value to filter the data in the News object.

In this scenario:

1. Add a data repeater to the page and configure it as follows:
    
    1. Select the News custom object.
    2. In the Filters section, set the criteria to Status Equals Fixed value.
    3. Enter Approved in the Value text box.
    
    This configuration tells the data repeater to return only records where the Status field contains the value `Approved`.
2. To display the required fields, such as Title, Description, and Date, on the page, add data elements to the data repeater.

Example 2: Use a URL Query String to Dynamically Filter and Display Results on Another Page

In our second example, we have a custom object called “Products” that stores product information. However, some products are only available in certain locations, so we like to let customers view the products in their nearest city. In this case, we could create a Locations site page that contains links to each available city.

We want each link to open the Products site page, but only display products based on the user's selection. We can do this using URL query strings, which let us pass variable content between HTML pages. The variable information in this case is the product location; the data repeater doesn’t know which products to return until the user makes a selection.

In this scenario:

1. Add a data repeater to the Products page and configure it:
    1. Select the Products custom object.
    2. In the Filters section, set the criteria to City Equals URL query string.
    3. In the Value text box, enter the variable name—in this case, location.
    4. If query string is missing dropdown list, select **Don't apply this filter item**. This option is used when a customer wants to view all products without filtering.
    5. Click **Save**.
2. Add data elements for the fields you want to display, such as Product Name, Description, and Price.
3. On the Locations page, add a data repeater and select the Products custom object.
4. Add a data element to the data repeater to represent the City field and configure it:
    1. Select the City field as the field to display, because we want to use the name of the city as the hyperlink.
    2. Select Text as the display format.
    3. Select **Add a hyperlink** to display a URL on the page.
    4. In the Link to dropdown list, select An item in your site.
    5. Select Page as the type and select the Products page. (If you can't see the list of pages, place your cursor in the URL text box and press the DOWN key on your keyboard.)
    6. Change the URL value to /product?location={!City}. In this case, {!City} is a placeholder for the value of a record's City field. When the page first loads, {!City} is replaced with the correct value, such as Dallas, which creates this URL for that record:
        
        ```
        /product?location=Dallas
        ```
        
        When clicked, the Products page opens with `Dallas` listed as the value of the location variable.
    7. For the tooltip, select the City field and click **Customize**.
    8. Change the value to Show me products available in {!City}.
        
        Again, the value of the City field replaces the {!City} placeholder for each record when the page loads.

Now, when the Locations page loads, the data repeater displays the location of each product as a link. When a customer clicks a link, such as Dallas, the Locations page passes `location=Dallas` to the Products page. As the Products page loads, the data repeater uses this value to dynamically return only records where the City field contains the value `Dallas`.

#### See Also

- [Dynamically Retrieve Data with Data Repeaters](https://help.salesforce.com/s/articleView?id=platform.siteforce_data_repeater.htm&release=264.0.0&type=5 "Use a data repeater to connect to a standard or custom Salesforce object and retrieve a dataset based on the filter criteria that you specify.")
- [Display Data or Content Using Data Elements](https://help.salesforce.com/s/articleView?id=platform.siteforce_data_repeater_element.htm&release=264.0.0&type=5 "You can use a data element to display the data retrieved by a page data connection or a data repeater. The data element binds to a field in the object and acts as a placeholder that's replaced with the field's data when the page loads.")
- [Dynamically Retrieve Data with Data Tables](https://help.salesforce.com/s/articleView?id=platform.siteforce_data_table.htm&release=264.0.0&type=5 "Use a data table to connect to a standard or custom Salesforce object, retrieve a dataset based on the filter criteria that you specify, and display one or more record as rows in the table.")
- [Access Data in Related Objects Overview](https://help.salesforce.com/s/articleView?id=platform.siteforce_data_nested_overview.htm&release=264.0.0&type=5 "Standard and custom objects have relationships that define how records in one object relate to records in another. For example, the Accounts object has a one-to-many relationship with the Contacts object—that is, each account can have one or more contacts associated with it. This relationship is also known as a parent-to-child or a master-detail relationship.")