Transformer une colonne de donnees decimals en hexadecimal

Hi i want to convert decimal data in hexadecimal. Thanks

Try this in a javascript column. The p1 parameter is the number you want to convert.

let num = parseFloat(p1);
return num.toString(16);
1 Like

I want to convert rfid_bis in hexadecinal

1 Like

Thanks

Hi i have an other problem i want to inverse chiffres for example.
2F86D431 it s resultant after formula but i need to inverse like this
F2684D13.
Thanks

Hi! Do you mean to change digits order? Does the qty of digits every time same?

let arrInput = p1.match(/.{1,2}/g);
let i = 0;

while(i < arrInput.length ) {
   arrInput[i] = 
   arrInput[i].split('').reverse().join('');
   i++;
}

return arrInput.join('');

Yes can you show me exactly how you do.thanks

Create a javascript column, copy and paste the code above and set the p1 parameter to the column that you want to inverse. Exactly the same procedure that @slscustom.ru is showing in his image from a couple days ago.

1 Like

thanks i want to obtain


at right it the code with your fomule but i want the code on the left.thanks

OK, you initially asked to swap every two characters, but now you are saying that you want the entire thing to be reversed?

This should be all you need.

return p1.split('').reverse().join('');

It doesn’t look like a shift of the string, but of every couple
2F 34 30 41 > 41 30 34 2F
(A shift would produce 140343F2)

It feels like this should have a name
A little endian ?

Would ChatGPT give a correct answer ?

It looks like it’s working

  let hexStr = p1.toString(16); 
  if (hexStr.length % 2 !== 0) {
    hexStr = '0' + hexStr; 
  }
  let hexBytes = [];
  for (let i = 0; i < hexStr.length; i += 2) {
    hexBytes.unshift(parseInt(hexStr.slice(i, i+2), 16)); 
  }
  return hexBytes.map(b => b.toString(16).padStart(2, '0')).join(''); 
1 Like

thanks it s perfect