# How to read the bitmask for alarm events

**URL:** <https://forum.inductiveautomation.com/t/how-to-read-the-bitmask-for-alarm-events/61445>\
**Category:** Ignition\
**Created:** [July 1, 2022, 6:03pm UTC](https://forum.inductiveautomation.com/t/how-to-read-the-bitmask-for-alarm-events/61445 "2022-07-01T18:03:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [July 1, 2022, 6:03pm UTC](https://forum.inductiveautomation.com/t/how-to-read-the-bitmask-for-alarm-events/61445/1 "2022-07-01T18:03:54Z")

</div>

I need to make a case statement or something to make this column human readable. But, want to make sure I am supplying right info. These are the distinct eventFlags in my table as well as their bin().

2 things… 1 is the bin() function on MySql give you the correct binary, is it read right to left or vice versa? and 2 is my description for int- 28 correct?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0c1d97279fab5b3a19f34b7b6501709c3f3cfda3.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/c/8c69f0841f9c40255789329244fca9d8dd3a41c2.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 2, 2022, 8:49am UTC](https://forum.inductiveautomation.com/t/how-to-read-the-bitmask-for-alarm-events/61445/2 "2022-07-02T08:49:39Z")

</div>

I don’t know about the MySQL thing, but I think you got it right.  
If you can use a script, you could use something like that to avoid making the mapping manually for each combination:

```python
def get_statuses(flag):
	flags_map = [
		"system event",
		"shelved event",
		"system acknowledgement",
		"acknowledge event",
		"cleared event"
	]
	return ", ".join(status for i, status in enumerate(flags_map) if flag & (1 << i))

```
