rptfilterset |
|
The rptfilterset object is a data member of the pvxreport, rptline and rptcell objects, delegated to store and manipulate a filter set definition. One object is created for each filter set. The pvxreport GetFilterSet( ) method can be used to retrieve the object handle for an rptfilterset object, which allows access to all the object's methods and properties. This object contains a group of rptfilter objects that make up the individual filters belonging to the set.
The following table lists the properties of the rptfilterset object:
Property |
Description |
Dynamic |
Boolean value (0/1) indicating whether the filter set contains a Dynamic Filter. (The Dynamic property was added in PxPlus 2022.) |
FilterCount |
Number of rptfilter objects in the filter set. |
Option$ |
Contains an "A" (Accept) or "R" (Reject). |
The following table lists the methods of the rptfilterset object:
Method |
Description |
AddFilter( ) |
Creates a new
rptfilter object using the next available sequence number. One object is created for each filter definition. The sequence number can be used as the index number to identify the object when using the RemoveFilter( ) and GetFilter( ) methods. |
ClearFilters( ) |
Removes all rptfilter objects in the set and resets FilterCount to 0. |
FilterCount( ) |
Returns the number of rptfilter objects in the set. |
GetCondition$(idx) |
Returns a string containing the PxPlus expression associated with a filter. |
GetFilter(idx) |
Returns the handle for an
rptfilter object. |
RemoveFilter(idx) |
Removes an
rptfilter object. |
In this example, the sample program creates the filter set and adds the filters to the filter set:
! invoicelist - Print a range of invoices
!
! This program prints a list of invoices, with an optional invoice range.
! It is a called program that accepts a report definition as the first argument
! and optional start and end invoice values as the second and third arguments.
!
! After loading the report, the program adds filters if the start and end
! values are supplied.
!
! Lastly, it generates the report to the Viewer.
!
enter ReportName$,StartAt$,EndAt$,err=*next
!
rpt=new("*rpt/pvxreport")
if Rpt'open(ReportName$)=0 \
then goto WrapUp
!
! Create the filter set
if StartAt$+EndAt$<>"" \
then Rpt'ClearFilters();
fs=Rpt'AddFilterSet()
! Now add the filters to the filter set
if StartAt$<>"" \
then fltr=fs'AddFilter();
fltr'Variable$="InvoiceNumber$";
fltr'ConditionCode=6;
fltr'IsCaseSensitive=0;
fltr'SetCompareValue(1,quo+StartAt$+quo)
if EndAt$<>"" \
then fltr=fs'AddFilter();
fltr'Variable$="InvoiceNumber$";
fltr'ConditionCode=5;
fltr'IsCaseSensitive=0;
fltr'SetCompareValue(1,quo+EndAt$+$FF$+quo)
!
! Now generate the report
Generate_Report:
open (hfn,err=WrapUp,opt="Normal;"+Rpt'GetPageSetup$())"*viewer*";
prt=lfo
Rpt'OutputPrint(prt)
Rpt'RunReport()
close (prt)
WrapUp: \
drop object Rpt
end