Hexadecimal to DecimalHello ,
Received a customer request to import files with many Hexadecimal columns. e.g. 0xeadf, 0xffdb;
in JMP13, when we simple paste/import the data into JMP, JMP will automatically change those hex columns into countinuous data e.g. 65499, 60127...
while when they upgrade to JMP14* , the hex columns remains as character like "0xeadf", even when remove the prefix "0x" , it remains.
foumular Hex To Number(:Col name) only works for newly created continuous cols , but not for existing hex cols
--> this will not solve customer problem as many hex cols. to deal (JMP15 is same behavior as JMP14)
attached 2 pictures

Questions:
1): what's the different setting that in JMP13 vs JMP14, possible for user to configure ?
2): if Q1 not possible, anyone have any idea to deal with this situation ?
Thanks for any thought and idea, wish you a happy Friday
Pin
Re: Hexadecimal to Decimal@andreacoombs1, does Hex to Number() give you what you're looking for?

Re: Hexadecimal to Decimal@brady_brady I was talking with IBM today and this conversion tool is exactly what they needed. They are converting between base 10 and 16. Any updates on this - Was it every converted to an addd-in? Is the capability available in natively in the software?
I was able to use Hex to Number() and Hex() to do this conversion. (see attached)
Re: Hexadecimal to DecimalHi Pin and Don,
I know I am late to this discussion, but want to add that I've always wished for a base conversion function in JMP. Below is a tool I wrote a while back to convert between any 2 integer bases, between base 2 and base 36, inclusive.
The function call specification is:
b1Tob2 (n(string), b1(number), b2(number)) -> result(string)
It assumes all values are correctly specified (that is, you cannot have the number 376 in base 5, as digits greater than 5 are not used in base 5). As Pin mentions, preprocessing (removing "0x" for example) may be necessary before applying the function.
Shown below is the code for using the tool in a formula column. All that must be changed is the last line, to match the table's column names, and the formula should still work with the Standardize Attributes procedure that Don described. This could easily be turned into an addin and make for an interesting blog. Perhaps I'll do that at some point.
I've also included a screenshot of the formula in use, and attached an example table.
Cheers,
Brady
names default to here(1);
decToB = Function( {n, b},
{a, s},
s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
n = Num( n );
a = "";
While( n >= 1,
a = Substr( s, Mod( n, b ) + 1, 1 ) || a;
n = Floor( n / b );
);
a;
);
bToDec = Function( {n, b},
{s},
s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
c = 0;
n = Char( n );
For( i = 1, i <= Length( n ), i++,
a = (c + Contains( s, Substr( n, i, 1 ) )) - 1;
c = a * b;
);
a;
);
b1Tob2 = Function( {n, b1, b2},
{default local},
n = Char( n );
decTob( btoDec( n, b1 ), b2 );
);
b1Tob2( :Number, :Original Base, :New Base );

Re: Hexadecimal to DecimalThank you so much Don. @DonMcCormack
your solutions works well just with just a little modification: replace prefix "0x" first (JMP14, JMP15 works the same way)
i think you are using work around solutions to create respective continuous cols. --> so that "hex to number" formular could work later in the formular standardization
(haha, hope our developer could make the "hex to number" formular works directly on those hex cols if possible in future
)

so now, we will have the original hex columns. + their respective continuous columns with the name e.g. Length[FG0]
( up to the user preference to change the header name
)
Thanks again. Wish you a safe trip, see you soon ~
Re: Hexadecimal to DecimalPin,
One thing I noticed is that the copy and paste in JMP 13 does not necessarily give the correct results. The attached Excel Workbook has 3 sets of identically valued columns with the last two sets being hex representations. Pasting the last set of columns does not give the same results as the first set, but it should. I'm not sure if development was aware of this and changed the behavior between 13 and 14. Regardless, I would not use copy and paste in versions 13 and older for this reason. A relatively simple solution is to:
- Select the character hex value columns, right click and select New Column Fomula > Character > Length.
- Select the newly created columns and go to Cols > Standardize Attributes.
- Select Standardize Attributes > Formula. Edit the formula and replace Length with Hex to Number
- Check the box Substitute Column Reference (this is important)
- Click Apply
This should convert the columns to their correct values. Hope this helps.
Don