Search code examples
powerappsbitflags

How to check if a bit is set in PowerApps?


How do I check if a particular bit is set on an integer value within a PowerApp? There doesn’t seem to be a built-in operator or function for bit manipulation.

As I do need this for quite few operations, using an external / Custom Connector is probably too expensive for me.


Solution

  • To find if a bit b of a number val is set, you can use an expression like the one below:

    RoundDown(Mod(val,Power(2,b+1))/Power(2,b),0)
    

    An example of this expression is shown below:

    enter image description here