3 followers Follow

Numbers to text

I am trying to find a way to convert my dollar amounts into text so that when a contract is generated from glowbiflow i am able to have the dollar amount in numbers and text. Is this even possible?


Please sign in to leave a comment.



Hi David,

yes possible. This one returns 1,234 as

one thousand two hundred thirty-four

var convert = String(Math.floor(@number field)); 

function int_to_words(int) {
if (int === 0) return 'zero';
var ONES = ['','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'];
var TENS = ['','','twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety'];
var SCALE = ['','thousand','million','billion','trillion','quadrillion','quintillion','sextillion','septillion','octillion','nonillion'];

function get_first(str) {
return ('000' + str).substr(-3);

function get_rest(str) {
return str.substr(0, str.length - 3);

function triplet_to_words(_3rd, _2nd, _1st) {
return (_3rd == '0' ? '' : ONES[_3rd] + ' hundred ') + (_1st == '0' ? TENS[_2nd] : TENS[_2nd] && TENS[_2nd] + '-' || '') + (ONES[_2nd + _1st] || ONES[_1st]);

function add_to_words(words, triplet_words, scale_word) {
return triplet_words ? triplet_words + (scale_word && ' ' + scale_word || '') + ' ' + words : words;

function iter(words, i, first, rest) {
if (first == '000' && rest.length === 0) return words;
return iter(add_to_words(words, triplet_to_words(first[0], first[1], first[2]), SCALE[i]), ++i, get_first(rest), get_rest(rest));
return iter('', 0, get_first(String(int)), get_rest(String(int)));

var arr = convert.split(" ");
var converted = [];
for(var i = 0; i < arr.length; i++){
converted.push(isNaN(arr[i]) ? arr[i] : int_to_words(arr[i]," "));
converted.join(" ")

Note 1: This code is based on the code provided by eat_chocolate, //, I modified it a bit for the use in Podio. 
Note 2: Decimals are rounded to floor: 1,234.99 will be rounded to 1,234 and that will be parsed to text, decimals won't be parsed to text. 
Note 3: Replace @number field with your field where the amount is in.


Rainer Grabowski 1 vote

Hi Rainer 

is it only for international Numbering system which convert into text what if there is money field having multiple set currency option so if i select INR so the result format should come into that country numbering it Possible to set dynamic value depending on that country numbering system in text format ???

MD Rabbani 0 votes

Hi MD,

yes , that's possible.

But in a calculation field you don't have access to the currency, only to the amount (means: There's no currency variable token which you can put into the calculation) .

You would need a workaround. You can add a text field and enter the currency (which is set in the money field) there, then the calculation field "knows" the currency. Or you let a flow (Globiflow) enter the currency in the text field. Or if your setup allows this you have another indicator (address of clients or whatever) for which currency should be used.

In the calculation you need some IF conditions and some variables for each possible language/country.


Rainer Grabowski 0 votes