Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

wordnum

Avatar

Level 2

Untitled.png

i am trying to write the code to convert the numeric value in words but I've got the above error while executing the code

8 Replies

Avatar

Level 8

Looks like you have a typo with the GrandTotal, make sure that's the field name.  Also if there are none numeric characters in the field such as 2,000 (the comma) you'll get a ****** result

Avatar

Level 2

please see the error file listed below

error.png

Please see the numeric field properties shown in image inserted below

prop_num_field.png

And now see the properities of text field along with script in image inserted below

Prop_txt_field.jpg

now the problem is when i have rename the caption of numeric field it shows it on screne & it disturbes the formatting of the table so i have changed the name of these fields in binding section as shown in both images but i couldn't get the desired results & I also would like to know that when i have press the delete(-) button of table it deletes the very next record of the table it dosen't sounds good while we are using it. is it possible to resolve the issue?

uma shankar

Avatar

Level 10

The script fails because the SOM expression to the GrandTotal field in incomplete.

Change it into:

var Z = Table1.FooterRow.GrandTodal.rawValue

Avatar

Level 2

i have changed the same but still it dosen't work please see the attachment

updated.png

please see while i am running the script it looks like this

run script.png

in this screen shoot the curser is positioned at the field name"attended by" but it still dosen't work

Avatar

Level 7

OK, I'm trying to get an idea of where all of the fields are on your form. You have "Nett_pay" selected in the first picture. It looks like the only event that has a script is the "initialize" event. So, unless there's a button somewhere that causes that field to be generated later, that script only runs when you open the page.

Perhaps you could put that event on the "enter" event for whatever text field is captioned "Attended By." (TextField8, I would guess.) I would also guess that the "Nett_pay" field is protected, since you don't want people editing the amount of money you're paying them on that line. If you move it there, you'll cause that script to run once you tab down to it on the form. Your user will see that the cursor is in the "Attended By:" field, and the script will fill in the amount of money.

As for the button, you'd have to show the code or actionbuilder screen for us to help make sure it is deleting the correct row.

Avatar

Level 2

script.png

please see this i have made further changes in script but i wouldn't get the desired results

uma shankar

Avatar

Level 7

OK, let's look at what the code is doing one line at a time.

var Y; initialize a variable "Y"

var Z; initialize a variable "Z"

Z = Table1.FooterRow.GrandTotal.rawValue; set the value in that cell to "Z"

Y = Nett_Pay.rawValue; Are you typing this in? It seems like you would want that filled in by something else. Each picture I've seen shows this field empty.

Y = Replace(Y,"Dolars","Rupees"); right now, Y is null, so there's nothing to replace.

Y = Replace(Y,"Cents", "Paise"); still null, so this doesn't do anything, either.

Nett_Pay.rawValue = Y; Y was null, so now Nett_Pay is null, too.

Maybe you want this:

var Y;

Y = Table1.FooterRow.GrandTotal.rawValue; I'm guessing that this is a currency value, so...

Y = Replace(Y, "Dollars","Rupees");

Y = Replace(Y,"Cents","Paise");

Nett_Pay.rawValue = Y; place the currency value into this field with dollars changed to rupees and cents changed to paise.

Avatar

Level 2

as you will go through pic no.6 i have put a value in numeric field name"GrandTotal" & when i moves down the courser to field name"Nett_Pay" the script must run and should convert the value like (as shown in pic no. 6 the numeric field has a value of 3825 & i wants to convert it E.g. "Rupees Three thousand eight hundred twenty five only")but the script dosen't performs the task as i desired. If you need the original file i can send it to you if you can give me your mail id.

uma shankar