Binary Number Issue
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Labels:
- Best Practices
- Tips and Tricks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @Jonlovett you can use PadLeft() to do this:
PadLeft(tostring([Binary]),8,'0')
Will add those leading zeros.
Hope that helps,
Ollie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- On the Functions page, I use the link on the left for "Functions: Quick Reference", which is this page: https://help.alteryx.com/20221/designer/functions-quick-reference
- Then I search the webpage for keywords like "leading" or "pad"
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
Any questions or issues please ask!
Ira Watt
Technical Consultant
Watt@Bulien.com