on 03-22-2019 3:27 PM
Hi All,
Could you please tell me how I can convert Hexadecimal to Decimal in Webi Report.
I have to convert it in Webi Report only, cant modify DB or Universe.
Try something like:
[Digit 4]=tonumber(if(Substr([v_test];Length([v_test]);1)="a" or Substr([v_test];Length([v_test]);1)="A") then "10" else if(Substr([v_test];Length([v_test]);1)="b" or Substr([v_test];Length([v_test]);1)="B") then "11" else if(Substr([v_test];Length([v_test]);1)="C" or Substr([v_test];Length([v_test]);1)="C") then "12" else if(Substr([v_test];Length([v_test]);1)="D" or Substr([v_test];Length([v_test]);1)="D") then "13" else if(Substr([v_test];Length([v_test]);1)="E" or Substr([v_test];Length([v_test]);1)="E") then "14" else if(Substr([v_test];Length([v_test]);1)="f" or Substr([v_test];Length([v_test]);1)="F") then "15" else Substr([v_test];Length([v_test]);1)) * Power(16;0)
[Digit 3]= tonumber(if(Substr([v_test];Length([v_test])-1;1)="a" or Substr([v_test];Length([v_test])-1;1)="A") then "10" else if(Substr([v_test];Length([v_test])-1;1)="b" or Substr([v_test];Length([v_test])-1;1)="B") then "11" else if(Substr([v_test];Length([v_test])-1;1)="C" or Substr([v_test];Length([v_test])-1;1)="C") then "12" else if(Substr([v_test];Length([v_test])-1;1)="D" or Substr([v_test];Length([v_test])-1;1)="D") then "13" else if(Substr([v_test];Length([v_test])-1;1)="E" or Substr([v_test];Length([v_test])-1;1)="E") then "14" else if(Substr([v_test];Length([v_test])-1;1)="f" or Substr([v_test];Length([v_test])-1;1)="F") then "15" else Substr([v_test];Length([v_test])-1;1)) * Power(16;1)
[Digit 2] = tonumber(if(Substr([v_test];Length([v_test])-2;1)="a" or Substr([v_test];Length([v_test])-2;1)="A") then "10" else if(Substr([v_test];Length([v_test])-2;1)="b" or Substr([v_test];Length([v_test])-2;1)="B") then "11" else if(Substr([v_test];Length([v_test])-2;1)="C" or Substr([v_test];Length([v_test])-2;1)="C") then "12" else if(Substr([v_test];Length([v_test])-2;1)="D" or Substr([v_test];Length([v_test])-2;1)="D") then "13" else if(Substr([v_test];Length([v_test])-2;1)="E" or Substr([v_test];Length([v_test])-2;1)="E") then "14" else if(Substr([v_test];Length([v_test])-2;1)="f" or Substr([v_test];Length([v_test])-2;1)="F") then "15" else Substr([v_test];Length([v_test])-2;1)) * Power(16;2)
[Digit 4] = tonumber(if(Substr([v_test];Length([v_test])-3;1)="a" or Substr([v_test];Length([v_test])-3;1)="A") then "10" else if(Substr([v_test];Length([v_test])-3;1)="b" or Substr([v_test];Length([v_test])-3;1)="B") then "11" else if(Substr([v_test];Length([v_test])-3;1)="C" or Substr([v_test];Length([v_test])-3;1)="C") then "12" else if(Substr([v_test];Length([v_test])-3;1)="D" or Substr([v_test];Length([v_test])-3;1)="D") then "13" else if(Substr([v_test];Length([v_test])-3;1)="E" or Substr([v_test];Length([v_test])-3;1)="E") then "14" else if(Substr([v_test];Length([v_test])-3;1)="f" or Substr([v_test];Length([v_test])-3;1)="F") then "15" else Substr([v_test];Length([v_test])-3;1)) * Power(16;3)
Final Decimal object will be:
[Decimal number] = [Digit4] + [Digit3] + [Digit2] +[Digit1]
This is just a rough idea, I sure many of the thinks I am doing manual and repetitive can be done in more efficient way. Also this is for a four digit hexa number, so in case your number is shorter than 4 digit or longer have to make some amendments to it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.