Expand my Community achievements bar.

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

Decimal convert

Avatar

Level 1

Hello Expert,

I realy need help urgently. Currently i'm developing SAP Adobe form. User requirement on the Decimal display have 3 type based on the table on SAP. The 3 type of display is as below :

A)     1.234.567.89

B)     1,234,567,89

C)      1 234 567,89

I already Have a hidden field in the form which stores the decimal notation from SAP. Now the problem is I cannot convert it to the decimal> i try tu use few way as below :

If (formatValue eq "A")

then

$.rawValue = "num{zzzzzzz9.99

endif

and

If (formatValue eq "A")

then

$.rawValue = Format("num{zzzzzzz9.99" &.rawValue)

endif

but it seems not working. Can anybody help me out? I'm dying here..:(

4 Replies

Avatar

Level 10

Try the following to set the picture format (pattern) for the field:

$.format.picture = "num{(zzzzzz9.99)}"

You can also use the prebuilt patterns like:

$.format.picture = "num.currency{}"

Avatar

Level 1

HI Jono,

Thanks for you info. I already try to use $.format.picture but is not work. My code is as below:

if ( data .mainpage.Itinerary.Itinerary.DataFormatValue.FormatValue2 eq "X"

then

$.format.picture = "num.currency{1.234.567,89}"

$.ui.picture = "num.currency{1.234.567,89}"

endif.

ALSO

if ( data .mainpage.Itinerary.Itinerary.DataFormatValue.FormatValue2 eq "X"

then

$.format.picture = "num{zzzzzz9.99}"

$.ui.picture = "num{zzzzzz9.99}"

endif.

My current filed is decimal field i also try to change to numeric field but stil still not working. any ideas?

Avatar

Level 10

It should work, I tested it here and it worked fine.

Where are you putting the code? "$" means "this" so if you aren't running the code on the field you are trying to affect you'll have to specify the path to the field.

Also what event are you trying to run the code on? How are you determining which format to use?

Are you getting any errors? In Acrobat press CTRL-J to bring up the console and see if you get any error messages.

You could try JavaScript as well, this is code I've copied from a working form. The syntax is a little different from FormCalc:

if (this.rawValue == 1){

     fieldName.format.picture.value = "num{(zz9.zz'%')}";

}

You'll want to take a look at the Picture Clause Specification as well, you're trying some patterns that won't work:

http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

Avatar

Level 10

Oh and I think I'd use a normal numeric field, not a decimal field.