meta data for this page
  •  

ibec_CmpVals

Compares two values.

Syntax

function ibec_CmpVals(Value1, Value2 : variant): variant;

Description

The ibec_CmpVals compares Value1 and Value2 and returns 0 if they are equal.

If Value1 is greater than Value2, ibec_CmpVals returns 1.

If Value1 is less than Value2, ibec_CmpVals returns -1.

If it is impossible to compare values the function returns NULL.

Example

execute IBEBlock
returns (iresult integer)
as
begin
  iresult = ibec_CmpVals(25, '25');
  suspend; /* Values are equal, iresult = 0 */

  iresult = ibec_CmpVals('25', 40);
  suspend; /* 25 is less then 40, iresult = -1 */

  iresult = ibec_CmpVals('ABC', 'abc');
  suspend; /* 'ABC' is less then 'abc', iresult = -1 */

  iresult = ibec_CmpVals(NULL, '25');
  suspend; /* NULL is less than any other value, iresult = -1 */

  iresult = ibec_CmpVals('25', NULL);
  suspend; /* Any value is greater than NULL, iresult = 1 */

  iresult = ibec_CmpVals(NULL, NULL);
  suspend; /* NULL is equal to NULL!!!, iresult = 0 */

  iresult = ibec_CmpVals('ABC', 25);
  suspend; /* Impossible to compare, iresult = NULL */

  iresult = ibec_CmpVals('24.56', 24.56);
  suspend; /* Values are equal, iresult = 0 */
end