Hi,

is there any solutions in Glide for transforming a number (100) into a text (one hundred) ?

I asked ChatGPT to write me a code in Java Script and the result is this one :

function numberToWords(number) {

const units = [‘’, ‘unu’, ‘doi’, ‘trei’, ‘patru’, ‘cinci’, ‘sase’, ‘sapte’, ‘opt’, ‘noua’];

const tens = [‘’, ‘zece’, ‘douazeci’, ‘treizeci’, ‘patruzeci’, ‘cincizeci’, ‘saizeci’, ‘saptezeci’, ‘optzeci’, ‘nouazeci’];

const teens = [‘’, ‘unsprezece’, ‘doisprezece’, ‘treisprezece’, ‘paisprezece’, ‘cincisprezece’, ‘saisprezece’, ‘saptesprezece’, ‘optsprezece’, ‘nouasprezece’];

const thousands = [‘’, ‘mie’, ‘mii’, ‘milioane’, ‘miliarde’];

if (number == 0) {

return ‘zero’;

}

let words = ‘’;

if (number < 0) {

words += 'minus ';

number = Math.abs(number);

}

if (number < 10) {

words += units[number];

} else if (number < 20) {

words += teens[number - 10];

} else if (number < 100) {

words += tens[Math.floor(number / 10)];

if (number % 10 !== 0) {

words += ’ ’ + units[number % 10];

}

} else if (number < 1000) {

words += units[Math.floor(number / 100)] + ’ sute’;

if (number % 100 !== 0) {

words += ’ si ’ + numberToWords(number % 100);

}

} else {

let i = 0;

while (number >= 1000) {

number /= 1000;

i++;

}

words += numberToWords(Math.floor(number)) + ’ ’ + thousands[i];

if (number % 1 !== 0) {

words += ’ ’ + numberToWords(number % 1);

}

}

return words.trim();

}

I used Code column from Glide tables (with Java Script), I stored my number column into p1 variable and I replaced this p1 variable in Java Script code. The result is nothing .

I don’t have any experience with JavaScript code (c’mon, I’m a Banker😜 ) and I need some guidance for this or a alternative solution for my problem.

Thank you,

M.V.