bittest()

Function group Execute on client Platform(s)
Binary Field NO All
Binary Field YES All

Syntax

bittest(binary,firstbitnumber,lastbitnumber)

bittest(binary,firstbitnumber[,lastbitnumber=firstbitnumber])

Description

Tests a range of bits (all bits with numbers >=firstBitNumber and <=lastBitNumber) in binary. binary must either be a binary field, or a long integer, you cannot use a function in the first argument. Returns a Boolean (true if at least one bit in the range is set).

If any are 1, the function returns 1, otherwise it returns zero.

The first parameter can be a Binary or an Integer; in the case of Binary, you need to provide a variable, and not the result of a calculation.

If lastBitNumber is omitted, the value in firstBitNumber is used allowing you to test a single bit.

When executing on the client, the binary argument must be a 32-bit integer variable.

See also bitset() and bitclear.

Example

Calculate lStatus as  bittest(lBinary,lFirstBitNumber,lLastBitNumber)