Creating Custom Operators in KReporter

As of KReporter v3.0.2 it has been possible to extend and create your own Customer Operators for the Reporting engine.  This can also be done in an upgrade Safe way – which is great news.

 

 

In the Selection Box the KReporter offer a defined set of operators for each type of field. Before 3.0.2 the set of operators per type was hardcoded and could not be changed. This is now configurable and extendable in:

modules/KReports/config

A new file can be found named:

KReportWhereOperators.php

Which defines the operators, as well as the assignment and sequence of these operators how they show in the reporter dialog. The file can be extended or overwritten if a file with the same name is found in

custom/modules/KReports/config

This allows you to also add e.g. custom field types and the operators will be evaluated properly then.
Within the File three variables are defined:
(1) $kreporterWhereOperatorCount: the listing of the available operators and if none, one or two fields can be set in the selection dialog (e.g. one field for equals, two for between)
(2) $kreporterWhereOperatorTypes: defines basic types and which operators are valid for each type.

(3) $kreporterWhereOperatorAssignments: assigns the Operator Type to a field type. The field type is the one that is either defined in the vardefs as field type or is overwritten in the fielddefs with a kreporttype. If the kreporttype is specified the kreporttype is evaluated.

Below is a Complete list of the default Operators in KReporter as of v.3.0.4

Please contact info@providentcrm.com or any of the team at KReporter for further details.

 

<?php

$kreporterWhereOperatorCount = array(
‘ignore’ => 0,
‘equals’ => 1,
‘notequal’ => 1,
‘before’ => 1,
‘after’ => 1,
‘between’ => 2,
‘today’ => 0,
‘past’ => 0,
‘future’ => 0,
‘thismonth’ => 0,
‘notthismonth’ => 0,
‘thisweek’ => 0,
‘next3month’ => 0,
‘lastmonth’ => 0,
‘last3month’ => 0,
‘lastndays’ => 1,
‘lastnfdays’ => 1,
‘lastnddays’ => 1,
‘lastnweeks’ => 1,
‘notlastnweeks’ => 1,
‘lastnfweeks’ => 1,
‘nextndays’ => 1,
‘nextnddays’ => 1,
‘betwndays’ => 2,
‘betwnddays’ => 2,
‘nextnweeks’ => 1,
‘notnextnweeks’ => 1,
‘thisyear’ => 0,
‘lastyear’ => 0,
‘tyytd’ => 0,
‘lyytd’ => 0,
‘isempty’ => 0,
‘isemptyornull’ => 0,
‘isnull’ => 0,
‘isnotempty’ => 0,
‘oneof’ => 1,
‘oneofnot’ => 1,
‘oneofnotornull’ => 1,
‘starts’ => 1,
‘notstarts’ => 1,
‘contains’ => 1,
‘notcontains’ => 1,
‘greater’ => 1,
‘greaterequal’ => 1,
‘less’ => 1,
‘lessequal’ => 1,
‘autocomplete’ => 1,
‘soundslike’ => 1
);

$kreporterWhereOperatorTypes = array(
‘varchar’ => array(
‘equals’,
‘soundslike’,
‘notequal’,
‘greater’,
‘greaterequal’,
‘less’,
‘lessequal’,
‘starts’,
‘notstarts’,
‘contains’,
‘notcontains’,
‘between’,
‘isempty’,
‘isemptyornull’,
‘isnull’,
‘isnotempty’
),
‘enum’ => array(
‘equals’,
‘notequal’,
‘oneof’,
‘oneofnot’,
‘oneofnotornull’,
‘starts’,
‘notstarts’,
‘contains’,
‘notcontains’,
‘isempty’,
‘isemptyornull’,
‘isnull’,
‘isnotempty’
),
‘id’ => array(
‘equals’,
‘autocomplete’,
‘isempty’,
‘isemptyornull’,
‘isnull’,
‘isnotempty’
),
‘double’ => array(
‘equals’,
‘notequal’,
‘greater’,
‘greaterequal’,
‘less’,
‘lessequal’,
‘between’,
‘isempty’,
‘isemptyornull’,
‘isnull’,
‘isnotempty’
),
‘date’ => array(
‘equals’,
‘notequal’,
‘before’,
‘after’,
‘past’,
‘future’,
‘between’,
‘today’,
‘lastndays’,
‘lastnfdays’,
‘lastnddays’,
‘nextndays’,
‘nextnddays’,
‘betwndays’,
‘betwnddays’,
‘thisweek’,
‘lastnweeks’,
‘notlastnweeks’,
‘lastnfweeks’,
‘nextnweeks’,
‘notnextnweeks’,
‘thismonth’,
‘lastmonth’,
‘last3month’,
‘notthismonth’,
‘next3month’,
‘thisyear’,
‘lastyear’,
‘tyytd’,
‘lyytd’,
‘isempty’,
‘isemptyornull’,
‘isnull’,
‘isnotempty’
),
‘bool’ => array(
‘equals’,
‘notequal’,
‘isemptyornull’,
‘isnull’
)
);

$kreporterWhereOperatorAssignments = array(
‘id’ => ‘id’,
‘varchar’ => ‘varchar’,
‘name’ => ‘varchar’,
‘relate’ => ‘varchar’,
‘text’ => ‘varchar’,
‘char’ => ‘varchar’,
‘double’ => ‘double’,
‘int’ => ‘double’,
‘float’ => ‘double’,
‘currency’ => ‘double’,
‘bool’ => ‘bool’,
‘enum’ => ‘enum’,
‘multienum’ => ‘enum’,
‘radioenum’ => ‘enum’,
‘parent_type’ => ‘enum’,
‘user_name’ => ‘enum’,
‘assigned_user_name’ => ‘enum’,
‘team_name’ => ‘enum’,
‘date’ => ‘date’,
‘datetime’ => ‘date’,
‘datetimecombo’ => ‘date’
);

if (file_exists(‘custom/modules/KReports/config/KReportWhereOperators.php’))
include(‘custom/modules/KReports/config/KReportWhereOperators.php’);
?>