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

Add a + when rawvalue >0

Avatar

Not applicable

Hi, can someone tell me if its possible to have a + (plus sign) added when the number value is calculated as 0 or higher? And how would it need to be entered? Thanks!

4 Replies

Avatar

Level 10

Hi,

You might be able to use the util.printf fuction, so util.printf('%,0+d',5) will return the string "+5" , this function is defined here, http://help.adobe.com/livedocs/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?h... There are lots of options, if you are dealing with decimal points change the d to an f.

Regards

Bruce

Avatar

Not applicable

Thanks for your reply Bruce, but you lost me, lol. I'm new to LC and creating tables within the program. Are you able to explain more? If it's too lengthy don't worry about it. It is not necessary for me to have this but it would nice to have in my form. Thanks again.

Avatar

Level 7

If I understand your question properly you want a + if the number is greater than 0. If that is correct you would need to write a script that says something like:

if(Field1.rawValue > Number(0)) {

this.rawValue = Field1.rawValue + "+"

}

You will need to make your field a text field as it will not accept the + sign. If your field you are getting the information from in my sample Field1 is not numeric then you need to use the Number(0) otherwise it will be treated as a non-numerical character.

Avatar

Level 10

Hi,

Using mouslander's sample you would write

util.printf("%,0d", Field1.rawValue)

This would be added to the calculate event and set the language to JavaScript.

The difference with my approach is that negative numbers have a sign as well.

Regards

Bruce