Skip to Content

HasFlag() mvSQL database function in Jitterbit App Builder

Summary

Evaluates an expression to determine if the field has a flag, and if the given flag is a composite (has more than one bit set) all the bits need to be set to return True. Returns True or False.

This function is shorthand for the bitwise operation:

IIF([ColumnWithFlags] & [ColumnOrValueOfASingleFlag] = [ColumnOrValueOfASingleFlag], True, False)

Syntax

HASFLAG(<bit-field>, <bit-flag>)

Parameters

bit-field

Column of type integer containing an aggregate of all flags set for that record.

bit-flag

Column or value containing the flag to evaluate for.

Returns

Returns True if Expression contains a flag, False if not.

Example

Given an in integer column named AccessRights with the following bit pattern:

  • 0 - None
  • 1 - Read
  • 2 - Create
  • 4 - Update
  • 8 - Delete

The following expression:

HasFlag(AccessRights, 1)

Will return True if the Read bit is set; False, otherwise.