Filters for Views

Last Updated 3/5/2015
You can customize and add filters to your view XML. Here are some tricks you may want to know.

Locating the Filters in the View XML

The Filters are usually located after the Fields in the XML.  Views will have a Required filter that defines the set of records in the view.
Here is an example of the People view
  <Filters>
    <Filter Id="PeopleFilter" Type="Required">
      <Eq Id="Type.Label" Value="People" />
    </Filter>

  </Filters>
  

Filter Types

Required
Required filters will be applied to the view every time the view is queried. Required filters help define the view by selecting which records appear in a view.

Saved
Saved filters are filters that can be applied either by selecting the filter an applying it in the view page or by adding it to a BRT.Lister, BRT.Detail, BRT.Index or EngineAdapter.

Creating a Filter

To create a filter start with filtering the records you want. When you have the records you want go the the Action menu select Developer Info


Get the XML Filter from Developer Info


You can now add the Filter to XML. between the  <Filters> </Filters> tags:
  • Add a <Filter> tag with an Id and Type and optionally a Name.  Be sure to add an end </Filter> tag
  • Between the <Filter> </Filter> tags paste the Filer XML you copied from Developer Info
  <Filters>
    <Filter Id="RecentUpdates" Type="Saved" Name="Recent Updates">      
         <Ge Not="true" FieldId="WhenUpdated" Value="2/1/2015 12:00:00 AM"/>
    </Filter>
  </Filters>
  •   Save your filter

Filter Options

Eq   
Equals  
<Eq FieldId="Authors.Id" Value="695023"/>
Ne
Not Equal
<Ne FieldId="Authors.Id" Value="695023"/>
Le
Not Greater Than
<Le FieldId="WhenUpdated" Value="2/1/2015 12:00:00 AM"/>
Gt
Greater Than     
<Gt FieldId="EndVisible" When="now"/>
Ge
Not Less Than
<Ge FieldId="WhenUpdated" Value="2/1/2015 12:00:00 AM"/>
Lt
Less Than
<Lt FieldId="StartVisible" When="now"/>
IsNull
IsNull
<IsNull FieldId="Address2"/>
Range
Between
<Range FieldId="WhenCreated" StartValue="2/1/2015 12:00:00 AM" EndValue="3/31/2015 12:00:00 AM"/>
Contains
Contains
<Contains FieldId="Title" Value="New"/>

StartsWith
Starts With
<StartsWith FieldId="Title" Value="New"/>

In List
In( )
<InList FieldId="Topic.Id"> 
     <Match Value="20941"/> 
     <Match Value="21447"/> 
</InList>
And
And
<And>
     <Eq FieldId="Invisible" Value="false"/>
     <Eq FieldId="NeedsApproval" Value="false"/>
</And>
Or
Or
<Or>
    <IsNull FieldId="EndVisible"/>
    <Gt FieldId="EndVisible" When="now"/>
</Or>
And Or
The Visible filter for Content is a good example of using a combination of And Or
<Filter Id="Visible" Type="SavedFilter" Name="Visible Content">
      <And>
        <Eq FieldId="Invisible" Value="false"/>
        <Eq FieldId="NeedsApproval" Value="false"/>
        <Or>
          <IsNull FieldId="StartVisible"/>
          <Lt FieldId="StartVisible" When="now"/>
        </Or>
        <Or>
          <IsNull FieldId="EndVisible"/>
          <Gt FieldId="EndVisible" When="now"/>
        </Or>
      </And>
</Filter>
When
Used with dates. You can specify now (customer local time), utcnow, or now and add and subtract days now  
<Gt FieldId="StartDate" When="now" />
utcnow
<Gt FieldId="StartDate" When="utcnow" />

now + 1
<Gt FieldId="StartDate" When="now +1" />
Not
Used to get the negative value
<Eq FieldId="Authors.Id" Not="true" Value="695023"/>

Article Topics

For Developers

Related Articles

Want to learn more?

Call 800-924-5220 or

Free trial