It would be useful if there were options that could be used as bitwise flags.
````CSharp
optionA = 1 = 0000 0001
optionB = 2 = 0000 0010
optionC = 4 = 0000 0100
3 = optionB and OptionC = 0000 0011
5 = optionA and OptionC = 0000 0101
6 = optionB and optionC = 0000 0110
7 = optionA and optionB and optionC = 0000 0111
optionD = 8 = 0000 1000
and so on......
````
Curiously, what would you use those for?
Before we have that, we would need a proper bitwise OR operator in AL.
Wouldn't it be nice, if we could write:
SalesHeader.PostAction := SalesHeader.PostAction::Ship | SalesHeader.PostAction::Invoice
@yrest I'm building such flags mostly with byte. Doing this manually in code units or manipulating the database or objects is annoying. I use them quite often (as in C# or c++). For example, for Id's that have different meanings or to mark something with flags. It is also interesting for queries because you can compare bitwise.
@vytjak has the perfect example ^^
It would probably make sense to add support for other bit operations, not only OR, at the same time.
@yrest I also see it this way: OR, XOR, AND, NOR plus negation and of course bitshifting would be nice << and >> for left and right shift.
Most helpful comment
Before we have that, we would need a proper bitwise OR operator in AL.
Wouldn't it be nice, if we could write:
SalesHeader.PostAction := SalesHeader.PostAction::Ship | SalesHeader.PostAction::Invoice