bitset()

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

Syntax

bitset(binary,firstbitnumber,lastbitnumber)

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

Description

Sets a range of bits (all bits with numbers >=firstBitNumber and <=lastBitNumber) operating directly on binary. Returns a Boolean (true for success).

The function operates directly on the argument, and returns 1 for success and 0 for failure. If the bit numbers identify some bits which are outside the current length of the binary field, Omnis extends the field by appending bytes with value zero, and sets the bits.

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 set a single bit.

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

See also bittest() and bitclear.

Example

Calculate lStatus as  bitset(lBinary,lFirstBitNumber,lLastBitNumber)