Filter

Introduction #

Filter process helps to filter your data based on condition. It is like the WHERE statement in SQL Query. If your data is from database, we encourage you to use the filtering feature of database. However, if your data coming from other sources such as CSV or Microsoft Excel then you need Filter.

Sample Code #

<?php
use \koolreport\processes\Filter;
class MyReport extends \koolreport\KoolReport
{
    public function setup()
    {
        ...
        ->pipe(new Filter(array(
            array("region","=","asia"),
            array("customerAge",">",50)
        )))
        ...
    }
}

Operators #

Namedescriptionexample
=Equal toarray("age","=",32)
!=Not equal toarray("age","!=",32)
>Greater thanarray("age",">",32)
<Less thanarray("age","<",32)
>=Greater than or equal toarray("age",">=",32)
<=Less than or equal toarray("age","<=",32)
containContain a stringarray("name","contain","John")
notContainNot contain a stringarray("name","notContain","John")
startWithStart with a stringarray("name","startWith","John")
notStartWithNot start with a stringarray("name","notStartWith","John")
endWithEnd with a stringarray("name","endWith","John")
notEndWithNot end with a stringarray("name","notEndWith","John")
betweenBetween two given valuesarray("name","between",24,32)
notBetweenNot between two given valuesarray("name","notBetween",24,32)
inValue is in an arrayarray("name","in",array("peter","marry"))
notInValue is NOT in an arrayarray("name","notIn",array("peter","marry"))