Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Scientific notation in numeric fields

Avatar

Level 1

I need to be able to input scientific notation in numeric fields for my adobe forms.  I can put the pattern to num{9.99E} and it will allow me to put positive exponents and negative exponents to -3.  However, I need to input the number 4.76E-19 and it always changes it to 0.00E0.  What kind I do to keep this small of a number as 4.76E-19?

15 Replies

Avatar

Level 6

Hi,

I put pattern text{9'.'99'E-'99} to text field.

and now it displays in that style what you need.

See example.

Is it OK for you?

BR,

Paul Butenko

Avatar

Level 1

Will putting it in a text field, though, allow it to do a calculation with that number?

Avatar

Level 6

Hi,

You can covert it to number by using this script:

Number(TextField1.rawValue)

BR,

Paul Butenko

Avatar

Level 1

I have a similar problem. I need a field where users can input regular numbers (.1234) or scientific notation. When I tried the number patter {9.99E}, I can only enter numbers larger than 1.0E-03. Anything larger and it changes them to 0. I tried the suggestion for text pattern and cannot get that to work. When I use it, the field just lets me input any text or number objects and displays just as entered.

I will appreciate any information.

Kellye

Avatar

Level 6

Hi,

Unfortunatly in approach with text field numbers will not be formatted in scientific  notation, users will have to type numbers in correct format.

In approach with NumericField and patter {9.99E} i think there is some bug.

I can type this number:

1.JPG

After i lost focus from this field it will be formatted in tis style:

2.JPG

And sfter button click i will get this:

3.JPG

For big values everything working fine.

Is this bug!?

BR

Avatar

Level 1

So, is there no way to enter a number such as 2.99E-8 where it will not show up as 0?

Avatar

Former Community Member

Its not a bug. The 9.99E is indicating that you will only check the first three places hence the pattern is limiting you to .001 as the smallest number. If you want to display something bigger you will need more 9's. If the number is .0000000299 then the pattern woudl be 9.9999999999E. This will also cuase a number like .00123456 to be displayed as 1.23456E-3. Typically you want only three digits (two decimal places) so th epattern woudl be 9.99zzzzzzzzE.

So your 2.99E-8 will be:

9.99zzzzzzzzE

Are you using an edit pattern or just a display pattern?

Paul

Avatar

Level 1

Should it be an edit, display, data, or all three patterns??????????????

Avatar

Level 1

What should the edit pattern look like, so they could input as either scientific notation or regular (1.2E-5 or .000012)?

Thank you for the display pattern. It works!!

Kellye

Avatar

Level 1

I can get the display to work for E-8. However, if I puti n a lot of z's for say, E-34, it still doesn't work.

Avatar

Former Community Member

You need a 9 for each digit you want to display and a lowercase z for each position that you want. So in your case it woudl be 9.99zzzE

Paul

Avatar

Former Community Member

The Javascript engine will have limits to the max and min size of a number. I do not have my references handy but I believe it is in the E-17 range.

Paul

Avatar

Level 1

Yeah, you would think that E-17 would be enough for most situations

Avatar

Level 1

Unless you're a chemist and need to use numbers around 10^-34 quite often. lol