community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Binary Operations

Community Content Engineer
Community Content Engineer
Created on

Binary (bit level or bitwise) operations operate on one or more bit patterns or binary numerals at the level of their discrete bits. They are typically used to manipulate values for comparisons and calculations - and encryption!

 

These functions are in Formula Tool, in the Integer submenu of the Math menu:

 

formula tool.JPG

 

Binary values are stored as strings, retaining the leading zeros. To use these functions, you'll have to convert these to numerals.  Use the BinToInt() function to convert your binary strings to numeric values.  Once you've completed your calculations, use IntToBin() to get the binary values.  Note: you'll need to add your leading zeros back in, using the PadLeft function. 

 

E.g.:  PadLeft(IntToBin([converted_binary]),8,'0')

 

If you need the character associated with the binary value, use CharToInt().  Hex calculations work similarly.

 

formula tool2.JPG

 

BinaryAnd(n,m) – performs the logical AND operation on two binary numerals

 

BinaryNot(n) – performs logical negation, forming the complement (bits that are 0 become 1, and those that are 1 become 0)

 

BinaryXOr(n,m) -  exclusive disjunction essentially means 'either one, but not both nor none'. In other words, the statement is true if and only if one is true and the other is false.

 

A common use for XOR is a means of doing a parity check. A bitstring has even parity if the number of 1s in the string is even. It has an odd parity if the number of 1s is odd. If you XOR the bits together, you can tell whether a bitstring has even or odd parity.

 

ShiftLeft(n,b) / ShiftRight(n,b) - shifting left is equivalent to multiplication by powers of 2. So 5 << 1 is equivalent to 5 * 2, and 5 << 3 is equivalent to 5 * 8.  Shifting to the right is equivalent to division by powers of 2.

 

Please see the attached v10.5 workflow for a simple secret message conversion.

 

Happy Alteryx-ing!

Attachments