Aug 02, 2021 11:22 AM
Hi there! I’m using an API to retrieve the balance of crypto wallets. The issue is that the balances are returned in Hex decimal format and there isn’t a native function to convert from hex decimal to regular decimal in Airtable. The manual conversion is rather complex and not ideal at all. Wondering if there are any workarounds?
Thanks in advance!
Aug 02, 2021 06:53 PM
Do you know the upper limit for the hexadecimal number? Is there a minimum or maximum number of digits?
You say the manual conversion process is complex. What manual process are using?
Your best bet is probably using a script to do the conversion. If the numbers are small enough, you could use a formula field that parses out the digits and does the math, but a script would be more robust.
Aug 03, 2021 03:52 AM
Thanks for the response!
There are always 16 digits. For example 2212844d4c6e8000
The manual process is
(2212844D4C6E8000)₁₆ = (2 × 16¹⁵) + (2 × 16¹⁴) + (1 × 16¹³) + (2 × 16¹²) + (8 × 16¹¹) + (4 × 16¹⁰) + (4 × 16⁹) + (13 × 16⁸) + (4 × 16⁷) + (12 × 16⁶) + (6 × 16⁵) + (14 × 16⁴) + (8 × 16³) + (0 × 16²) + (0 × 16¹) + (0 × 16⁰) = (2455170214400000000)₁₀
Unfortunately I don’t have any experience writing scripts but will search online to find one!
Aug 03, 2021 06:01 AM
Thank you for describing the manual process. That is the same process that could be used by a formula or a script. If there are always 16 digits, it might be possible to write a formula, but it might be pushing the limits of a formula field. If you have trouble finding a script online but have budget to hire someone to write the script, feel free to book an appointment with me.
Aug 04, 2021 07:52 AM
Thank you, managed to figure out a solution but appreciate the offer!