Database ( How to retrieve data from database) - Filter
Filter
With the filter function you can retrieve data from database. The database will contain following data.
The function contains following parameters.
1) $itemname - Database column (field) name(s) you need to filter.
2) $value - Column values that should match when filtering.
3) $exact_match - Whether this should match whole word or partial? If $exact_match is set to true, It will return only exact match results. If $exact_match is set to false, It will return both whole word matches and partial matches as result.
4) $and_or - You can set "AND" "OR" logic here.
5) $sortitem - The database column name which is used to sort the result.
6) $sort_order - You can set sort order here. Whether Ascending or Descending.
7) $max - Maximum number of records.
8) &$is_last - Whether the last item is loaded.
filter( $itemname, $value, $exact_match=true, $and_or="AND", $sortitem=null, $sort_order=SORT_ASC,$max=null,&$is_last=null)
filter([“vegetable”,”country”,”amount”],[“”,””,””],true,"AND",null,null,$max,$is_last)
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“pp”,”a”,””],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“P”,””,””],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“”,””,”1”],false,"AND",null,null,$max,$is_last) - Number can’t filter by partial match
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“”,””,”12”],false,"AND",null,null,$max,$is_last) - Number is always exact match
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“”,””,””],true,"AND",null,null,$max,$is_last) - Exact match return true
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“Apple”,””,””],true,"AND",null,null,$max,$is_last) - Exact match return true
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“apple”,””,””],true,"AND",null,null,$max,$is_last) - Exact match return false
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“Apple”,”America”,””],true,”AND”,null,null,$max,$is_last)
Result screen is shown below.
filter([“vegetable”,”country”,”amount”],[“Apple”,”America”,””],true,"AND",'vegetable',SORT_ASC,$max,$is_last) set sort item
Result screen is shown below.