1 Reply Latest reply on Aug 26, 2015 12:14 AM by abhedk22458412

# Convert numeric in words in adobe forms (start with the currency)

Hi to all,

Below script i found here for converting numeric into words and its work perfectly. Just I edit in UAE currency.

It is possible to move the dirhams (currency) in front like. 1,900,000.55 = Dirhams One Million Nine Hundred Thousand and Fifty Five fils Only. (with period)

or 1,900,085.55 = Dirhams One Million Nine Hundred Thousand Eight Five and Fifty Five fils.

Previous code was One Million Nine Hundred Thousand Eighty-Five Dirhams and Fifty-Five Fils

aTens = [ "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];

aOnes = [ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",

"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",

"Nineteen" ];

function ConvertToHundreds(num)

{

var cNum, nNum;

var cWords = "";

num %= 1000;

if (num > 99) {

/* Hundreds. */

cNum = String(num);

nNum = Number(cNum.charAt(0));

cWords += aOnes[nNum] + " Hundred";

num %= 100;

if (num > 0)

cWords += " and "

}

if (num > 19) {

/* Tens. */

cNum = String(num);

nNum = Number(cNum.charAt(0));

cWords += aTens[nNum - 2];

num %= 10;

if (num > 0)

cWords += "-";

}

if (num > 0) {

/* Ones and teens. */

nNum = Math.floor(num);

cWords += aOnes[nNum];

}

return cWords;

}

function ConvertToWords(num)

{

var aUnits = [ "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ];

var cWords = (num >= 1 && num < 2) ;

var nRight = Math.floor(num);

for (var i = 0; nLeft > 0; i++) {

if (nLeft % 1000 > 0) {

if (i != 0)

cWords = ConvertToHundreds(nLeft) + " " + aUnits[i - 1] + " " + cWords;

else

cWords = ConvertToHundreds(nLeft) + " " + cWords;

}

nLeft = Math.floor(nLeft / 1000);

}

num = Math.round(num * 100) % 100;

if (num > 0)

cWords += ConvertToHundreds(num) + " Fils";

else

cWords += "Zero Fils";

return cWords;

• ###### 1. Re: Convert numeric in words in adobe forms (start with the currency)

This can be done with many ways but just to name two you can do

1. Simple one, just add a caption to the Left for Dirham and then the rest of the value in the field.

2. Try concat.

var y

y = wordnum(Grandtotal)

this.rawValue = Concat("Dirhams ",y)