Bitmasks

Using the BitmaskedBehavior of Tools plugin together with Search plugin.

Single Select | Multi Select OR | Multi Select AND

Filter Single Select

Table

Some example records stored in DB

Id Name Flags raw (bitmasked) Flags (array)
1 Careful 8
  • 8 (Flagged)
2 I am promoted 6
  • 2 (Featured)
  • 4 (Approved)
3 I am a bit more important 7
  • 1 (Important)
  • 2 (Featured)
  • 4 (Approved)
4 I have no flags 0
    5 I am everything 15
    • 1 (Important)
    • 2 (Featured)
    • 4 (Approved)
    • 8 (Flagged)

    SQL query

    For example/demo purposes here the query it runs as per your filter selection above:
    SELECT 
      `BitmaskedRecords`.`id` AS `BitmaskedRecords__id`, 
      `BitmaskedRecords`.`name` AS `BitmaskedRecords__name`, 
      `BitmaskedRecords`.`flag_optional` AS `BitmaskedRecords__flag_optional`, 
      `BitmaskedRecords`.`flag_required` AS `BitmaskedRecords__flag_required`, 
      `BitmaskedRecords`.`created` AS `BitmaskedRecords__created`, 
      `BitmaskedRecords`.`modified` AS `BitmaskedRecords__modified` 
    FROM 
      `bitmasked_records` `BitmaskedRecords`

    Send your feedback or bugreport!