Filter: Difference between revisions

From Zymonic
Content added Content deleted
No edit summary
Line 30: Line 30:


== Grouped Filters ==
== 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:

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

Revision as of 16:17, 15 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>
      <TargetField>grouping_rf</TargetField>
    </GroupBy>
  </Filter>