How to read the bitmask for alarm events

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

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:

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))
1 Like