Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

WordNum - value correction

Avatar

Level 2

I was trying to express numeric value to words and changing currency from Dollars to Pesos. I did so through the following discussions:

Voucher.PNG

Details:

NOTE#1 - User Entered

NOTE#2 - Calculated (Read only)

NOTE#3 - Text Field. Calculated (Read only) WordNum from numeric value in NOTE#2.


topmostSubform.Page1.Amount::calculate - (FormCalc, client)


Replace ( Replace ( Replace( Replace ( WordNum (topmostSubform.Page1.Total, 2) , "Dollars ", "Pesos"), "Dollar ", "Peso"),  "Cents", "Centavos"), "Cent", "Cent")


Just the way I wanted it to display, unfortunately as you may have noticed in the image in NOTE#3 the value read as:

How do I correct it to:

And is it possible for me to able to have the value in upper case with at the end with ONLY.

Pardon me guys but I am NOT that good with scripts.

Thank you in anticipation of your positive response.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

try this.

It combines 2 more functions (Upper() and Concat()) with your existing script,


if (not topmostSubform.Page1.Total.isNull) then


  $ = Concat( Replace( Replace( Upper( WordNum(topmostSubform.Page1.Total, 2) ), "DOLLARS", "PESO" ), "CENTS", "CENTAVOS" ), " ONLY" )


else


  $ = ""


endif


0 Replies

Avatar

Correct answer by
Level 10

Hi,

try this.

It combines 2 more functions (Upper() and Concat()) with your existing script,


if (not topmostSubform.Page1.Total.isNull) then


  $ = Concat( Replace( Replace( Upper( WordNum(topmostSubform.Page1.Total, 2) ), "DOLLARS", "PESO" ), "CENTS", "CENTAVOS" ), " ONLY" )


else


  $ = ""


endif


Avatar

Level 2

THANK YOU very much for you're response.


if (not topmostSubform.Page1.Total.isNull) then


  $ = Concat( Replace( Replace( Upper( WordNum(topmostSubform.Page1.Total, 2) ), "DOLLARS", "PESOS" ), "CENTS", "CENTAVOS" ), " ONLY" )


else


  $ = ""


endif



Here's the result with just a few adjustment:


if (not topmostSubform.Page1.Total.isNull) then


  $ = Concat( Replace( Replace( Replace( Replace( Upper ( WordNum(topmostSubform.Page1.Total, 2) ), "DOLLARS", "PESOS" ), "DOLLAR", "PESO" ), "CENTS", "CENTAVOS" ), "CENT","CENT"), " ONLY" )


else


  $ = ""


endif



cv.PNG

Again, THANK YOU. Learn a few things from this. cheers to all.

IF others have something else in mind, please do not hesitate to share and post. Thank you. *cheers*