Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 29th, 2017, 11:11 AM
Susan Susan is online now
Regular Contributor
 
Join Date: Oct 2008
Location: Maitland, FL
Posts: 61
Default Add $9.00 to an amount in field

I have a field with a total amount. I need to add $9.00 to that amount. Can anyone help me with a rule to do this.
__________________
FusionPro Creator v10.1.11 / FusionPro Producer / FusionPro Expression 3.2.2 / Mac OSX 10.13.6 / Acrobat Pro DC
Reply With Quote
  #2  
Old June 29th, 2017, 12:03 PM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 474
Default Re: Add $9.00 to an amount in field

Try this:

Code:
var price = Field("Price") // Your field here
return '$' + (StringToNumber(price.replace(/[^\d\.]/g, '')) +9);
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11
Reply With Quote
  #3  
Old June 29th, 2017, 12:07 PM
Susan Susan is online now
Regular Contributor
 
Join Date: Oct 2008
Location: Maitland, FL
Posts: 61
Default Re: Add $9.00 to an amount in field

Thanks. This rules works great except I need 2 decimal places. ($525.00).
__________________
FusionPro Creator v10.1.11 / FusionPro Producer / FusionPro Expression 3.2.2 / Mac OSX 10.13.6 / Acrobat Pro DC
Reply With Quote
Old June 29th, 2017, 12:59 PM
dreimer
This message has been deleted by dreimer.
  #4  
Old June 29th, 2017, 01:09 PM
Susan Susan is online now
Regular Contributor
 
Join Date: Oct 2008
Location: Maitland, FL
Posts: 61
Default Re: Add $9.00 to an amount in field

Thanks for the reply.

For some reason my result is $9 with this rule. The entry in my field is $515.00. The previous rule below resulted in $524. I need it to be $524.00.

var price = Field("External_Data::cTotal") // Your field here
return '$' + (StringToNumber(price.replace(/[^\d\.]/g, '')) +9);
__________________
FusionPro Creator v10.1.11 / FusionPro Producer / FusionPro Expression 3.2.2 / Mac OSX 10.13.6 / Acrobat Pro DC
Reply With Quote
  #5  
Old June 29th, 2017, 01:14 PM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 474
Default Re: Add $9.00 to an amount in field

I had an error in the post I deleted. Try this.

Code:
var price = Field("YourFieldHere")
var price2 = (StringToNumber(price.replace(/[^\d\.]/g, '')) + 9);
return '$' + FormatNumber("#,###.00", price2)
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11

Last edited by dreimer; June 29th, 2017 at 01:16 PM..
Reply With Quote
  #6  
Old June 29th, 2017, 01:25 PM
Susan Susan is online now
Regular Contributor
 
Join Date: Oct 2008
Location: Maitland, FL
Posts: 61
Default Re: Add $9.00 to an amount in field

Thank you! You've saved me a lot of time and headaches!
__________________
FusionPro Creator v10.1.11 / FusionPro Producer / FusionPro Expression 3.2.2 / Mac OSX 10.13.6 / Acrobat Pro DC
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:46 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.