Susan Posted June 29, 2017 Share Posted June 29, 2017 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. Quote Link to comment Share on other sites More sharing options...
dreimer Posted June 29, 2017 Share Posted June 29, 2017 Try this: var price = Field("Price") // Your field here return '$' + (StringToNumber(price.replace(/[^\d\.]/g, '')) +9); Quote Link to comment Share on other sites More sharing options...
Susan Posted June 29, 2017 Author Share Posted June 29, 2017 Thanks. This rules works great except I need 2 decimal places. ($525.00). Quote Link to comment Share on other sites More sharing options...
Susan Posted June 29, 2017 Author Share Posted June 29, 2017 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); Quote Link to comment Share on other sites More sharing options...
dreimer Posted June 29, 2017 Share Posted June 29, 2017 (edited) I had an error in the post I deleted. Try this. var price = Field("YourFieldHere") var price2 = (StringToNumber(price.replace(/[^\d\.]/g, '')) + 9); return '$' + FormatNumber("#,###.00", price2) Edited June 29, 2017 by dreimer Quote Link to comment Share on other sites More sharing options...
Susan Posted June 29, 2017 Author Share Posted June 29, 2017 Thank you! You've saved me a lot of time and headaches! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.