Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Binary Number Issue

Jonlovett
5 - Atom

I have a database that contains a HEX string.

 

I need to split the string to individual 2 character sections and the convert this to binary.

 

Theses steps I've managed, but my issue is when Alteryx produces the result, the leading zero's are missed off.

 

The problems comes when I have to reverse the sections and join them back into 1 string.

 

Example

 

HEX = 20, DEC = 32, BIN = 00100000

Alteryx result = 100000

 

HEX = 65, DEC = 101, BIN = 01100101

Alteryx result = 1100101

 

Any suggestions please?

 

Jon

3 REPLIES 3
OllieClarke
15 - Aurora
15 - Aurora

Hey @Jonlovett you can use PadLeft() to do this:

PadLeft(tostring([Binary]),8,'0')

Will add those leading zeros.

Hope that helps,

 

Ollie

ChrisTX
15 - Aurora

As @OllieClarke mentioned, use PadLeft

 

Here's a list of all Functions: https://help.alteryx.com/currentversion/designer/functions

 

When I need to find a function, but don't know the function name

Chris

IraWatt
17 - Castor
17 - Castor

Hey @OllieClarke,

Similar to @OllieClarke's & @ChrisTX  answer I used PadLeft(). However each HEX character should be 4 bits long eg. 101 should be 000100000001:

IraWatt_0-1659014230210.png

Any questions or issues please ask! 

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Labels