Filter: Difference between revisions

From Zymonic
Content added Content deleted
Line 43: Line 43:
<GroupBy>
<GroupBy>
<ZName>gb_group</ZName>
<ZName>gb_group</ZName>
<DisplayName>Grouping</DisplayName>
<TargetField>grouping_rf</TargetField>
<TargetField>grouping_rf</TargetField>
</GroupBy>
</GroupBy>
</Filter>
</Filter>
<pre>
<pre>

The GroupBy XMLs can also be nested, resulting in what is known as a 'tree-view' filter. By default this displays as a series of expandable/collapsable groups, each with a group header at the top.

This XML:

<pre>
<GroupBy>
<ZName>gb_group</ZName>
<TargetField>grouping_rf</TargetField>
<DisplayName>Grouping</DisplayName>
<GroupBy>
<ZName>gb_group_level_2</ZName>
<DisplayName>Group level 2</DisplayName>
<TargetField>id_rf</TargetField>
</GroupBy>
</GroupBy>
</pre>


Produces:

(Add picture)

Revision as of 09:05, 16 May 2019

A filter captures data from the user using search fields and reports back matching results from a database table using report fields. It can be defined similarly to below:

  <Filter>
    <ZName>ts_fil_purchaserecords</ZName>
    <DisplayName>Purchase Records</DisplayName>
    <Category>Reports</Category>
    <ShortDescription>Shows all purchases</ShortDescription>
    <LongDescription>
      <p>Shows all of the purchase records</p>
    </LongDescription>
    <BaseTable>
      <ZName>ts_t_purchaserecords</ZName>
    </BaseTable>
    <FilterAction>
      <ZName>ts_fa_newpurchaserecord</ZName>
    </FilterAction>

    <!-- SearchFields -->
    <SearchField>
      <ZName>ts_sf_purchaseid</ZName>
    </SearchField>

    <!-- ReportFields -->
    <ReportField>
      <ZName>ts_rf_purchaseid_edit</ZName>
    </ReportField>
  </Filter>


Grouped Filters

A grouped filter has the results grouped by one of the fields, in a similar fashion to "group by" in SQL. This can be achieved simply by adding "GroupBy" to the filter, and referencing the group by in the report fields using "ApplyToGroups" like so:

  <Filter>
    ...
    <ReportField>
      <ZName>grouping_rf</ZName>
    ...
      <ApplyToGroups>gb_group</ApplyToGroups>
    </ReportField>
    <GroupBy>
      <ZName>gb_group</ZName>
      <DisplayName>Grouping</DisplayName>
      <TargetField>grouping_rf</TargetField>
    </GroupBy>
  </Filter>
<pre>

The GroupBy XMLs can also be nested, resulting in what is known as a 'tree-view' filter. By default this displays as a series of expandable/collapsable groups, each with a group header at the top. 

This XML:

<pre>
<GroupBy>
      <ZName>gb_group</ZName>
      <TargetField>grouping_rf</TargetField>
      <DisplayName>Grouping</DisplayName>
      <GroupBy>
        <ZName>gb_group_level_2</ZName>
        <DisplayName>Group level 2</DisplayName>
        <TargetField>id_rf</TargetField>
      </GroupBy>
</GroupBy>


Produces:

(Add picture)