Manoj Chaurasia Posted September 19, 2013 Share Posted September 19, 2013 Hi I'm trying to create a calculated column with integer values from hex. Step 1. Create a calculated column from a long string only representing hex values. Code: concatenate("0x",Mid([sequence sheet],218,2)) Hexarray = [0x0, 0x1, 0x2 ... 0xA, 0xB, 0xC] Step 2. Convert to integer to represent the data in a sorted manner Code; integer([Hexarray]) Returns empty I have tested the following which works: 1. integer(0xF) = 15 2. integer(string(0xF)) ) = 15 But this doesn't 3. integer(concatenate("0x","F")) = empty Can someone explain to me why 2 works but not 3 Thanks in advance Michael Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted September 19, 2013 Author Share Posted September 19, 2013 For the last example, the concatenate function returns a string value, so an integer value from a string is empty. This is not correct. One of the functions of integer() is typecasting. integer("08") = 8 integer(0xF) = 15 integer(string(01)) = 1 // Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted September 19, 2013 Author Share Posted September 19, 2013 Hi Michel, I expressed myself badly. When I wrote return a string, is one string with no number characters (in that case, the "x"), so the result is an error and spotfire treat as an empty value. I agree with you, a tool like spotfire needs to convert a string in hex. I think you can use the IronPython to do that. Can you give me more details for the use of the cast (string to hex) Regards, Jorge Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted September 19, 2013 Author Share Posted September 19, 2013 Hi Jorge When I realized that it couldn't be done I just opened the file in excel and created a new column which was equal to what I wanted to do in Spotfire (=HEX2DEC(TRIM(MID(K2;218;2)))). It's not optimal but it works for my needs. Using ironpython was new to me, it looks intresting and easy enough. I might look into it more in the future. Thanks for the tip. Regards Michael Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted October 23, 2015 Author Share Posted October 23, 2015 Hi Michel, For the first 2 examples, you didn't put the value between quotation marks, so Spotfire convert these hex in integer automatically. For the last example, the concatenate function returns a string value, so an integer value from a string is empty. Regards, Jorge Link to comment Share on other sites More sharing options...
Luc . Posted September 12, 2019 Share Posted September 12, 2019 Hi Great!! this action!! Function Dec2hex works. But back not, numbers are copied, chars are ignored. I hope that this example is clear... In excell I started with a number, then dec2hex then hex2dec then in SF dec2hex and dec2hex DecHexDec (2)SF-HEXSF-DEC 16 10 16 10 10 29 1D 29 1D 64 40 64 40 40 123 7B 123 7B I used: Hex2Dec Link to comment Share on other sites More sharing options...
Luc . Posted September 12, 2019 Share Posted September 12, 2019 We found the anwser! in calculate collumn write: Hex2Dec(Concatenate("0x",[sF-HEX])) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now