<pre_filter>

Abstract

Learn to configure the <pre_filter> element for Pull Reports™ Ad Hoc report and data service software.


Table of Contents

Catalog Configuration Java API reference:  PreFilter, TableConfigurationBuilder#setPreFilters

Use the <pre_filter> element to apply a filter condition to all requests which include the encompassing <table> in the Export Report REST API. <pre_filter>s are structured similarly to Export Report REST API filter HTTP parameters except without the table path preceding the '@' symbol.

The body of a <pre_filter> must follow the pattern:

@[ColumnId] [Operator] (Values)?

Where ColumnId must reference a <column> id attribute of the encompassing <table> or a <column> id of a <column_group> referenced with the encompassing table.

Usage

In the following example, two <pre_filter>s apply to the report's base table and one <pre_filter> applies to the child relationship /grade table.

Because the report's base table is always present in the report's export result, this <pre_filter> configuration always appends the following clauses to the Export Report REST API SQL where statement:

student_details.active = true and student_details.birth_date > '2011-11-02'

Additionally, if the /grade table is included within the Export Report REST API columns parameter, the SQL where statement will also contain the following clause:

class_info.grade.year is not null
Example 1. Via an XML Catalog file
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.6.1" id="class" name="Class Reports"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.pullreports.com/catalog-1.6.1
    https://www.pullreports.com/docs/xsd/pullreports-catalog-1.6.1.xsd">
    <report id="student-information" name="Student Information">
        <export_config defaultColumns='id,name'/>
        <table id="student" displayName="Student Details" name="student_details"> 
            <column id="id" name="id" displayName="Student ID" paramType="java.lang.Integer"/>
            <column id="name" name="student_name" displayName="Student Name"/>
            <column id="bdate" name="birth_date" displayName="Birth Date" paramType="java.sql.Date"/>
            <column id="active" name="active" displayName="Active" paramType="java.lang.Boolean"/>
            <pre_filter>@active = true</pre_filter>
            <pre_filter>@bdate > '2001-11-02'</pre_filter>
            <relationship join="inner">
                <join_column columnName="student_id" 
                             referencedColumnName="id" />
                <table id="grade" displayName="Grade" name="class_info.grade">
                    <column id="id" name="id" displayName="Grade ID" paramType="java.lang.Integer"/>
                    <column id="grade" name="grade" displayName="Grade"/> 
                    <column_group_ref ref="example_group"/>
                    <pre_filter>@year is not null</pre_filter>
                </table>
            </relationship>
        </table>
    </report>
    <!-- Demonstrates that <pre_filter>s may reference a <column> within a <column_group> -->
    <column_group id="example_group">
        <column id="year" name="year" displayName="Year"/> 
    </column_group>
</catalog>

Parents

<table>
<table_ref>