MaxDB PHP Generator online Help
Prev | Return to chapter overview | Next |
OnCustomCompareValues
This event allows you to define your own function for value comparison. Live example and video tutorial.
Signature:
function OnCustomCompareValues($columnName, $valueA, $valueB, &$result)
Parameters:
$columnName |
The name of currently processed column. |
$valueA |
The first value to compare. |
$valueB |
The second value to compare. |
$result |
The result of the comparison. Should be set to 0 if values are equal and to a non-zero value otherwise. |
Example
This example shows how to define an algorithm that considers two values to be equal if their difference is less than or equal to 0.5.
if (in_array($columnName, array('height', 'length', 'width'))) {
$result = abs($valueA - $valueB) <= 0.5;
}
The example can be seen in action in our Feature Demo.
Prev | Return to chapter overview | Next |