Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

WordNum - value correction

Avatar

Former Community Member

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


View solution in original post

2 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

Former Community Member

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*