Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Hexadecimal number conversion

longhui
7 - Meteor

Hello everyone, request to solve a problem:

 

There is a string of hexadecimal digits:02C89A2B1400000000D2CCE91600000000,divided into three parts

1.02

2.C89A2B1400000000 → C8  9A  2B  14  00  00  00  00(A group of two)→ 00 00 00 00 14 2B  9A C8(Reverse order)

3.D2CCE91600000000 →  D2 CC E9 16 00 00 00 00 (A group of two)→ 00 00 00 00  16  E9  CC  D2 (Reverse order)

 

00000000142B9AC8 and  00000000142B9AC8  Convert to decimal

 

Python can handle, but want to use Alteryx to solve,thanks!

 

 

4 REPLIES 4
ponraj
13 - Pulsar

Use formula tool with function HexToNumber(x) to convert hexadecimal to number. 

RobertOdera
13 - Pulsar

Hi @longhui 

 

Please mark as a Solution if this works for you.

Please try the below in Formula Tools (assuming the pattern I discern in your data).

 

Let Input = 02C89A2B1400000000D2CCE91600000000

Then:

First = Left(Trim(Input),2)

Input_2 = TrimLeft(Input,[First])

 

Get substrings.

 

Sub1 =Substring([Input2],0,2)

Sub2 =Substring([Input2],2,2)

Sub3 =Substring([Input2],4,2)

Sub4 =Substring([Input2],6,2)

 

Sub9 =Substring([Input2],16,2)

Sub10 =Substring([Input2],18,2)

Sub11 =Substring([Input2],20,2)

Sub12 =Substring([Input2],22,2)

 

Therefore:

Second = PadLeft([Sub4]+[Sub3]+[Sub2]+[Sub1], 16, '0')

Third = PadLeft([Sub12]+[Sub11]+[Sub10]+[Sub9], 16, '0')

 

Finally:

Hex To Number of Second = HexToNumber(Second)

Hex To Number of Third = HexToNumber([Third])

 

RNO2_0-1589123515860.pngRNO2_1-1589123531803.png

Please see attachment.

Good Luck!

 

 

longhui
7 - Meteor

thank you very much!

RobertOdera
13 - Pulsar

You're most welcome @longhui

Labels