Jump to content

Calculate reduction percentage


Recommended Posts

Hi friends,

I have a case where the user will enter a original price and a new reduced price, and we want a field to be calculated with the reduction percentage (-30%, -40%...).

Like in this screenshot :

http://forums.printable.com/attachment.php?attachmentid=981&stc=1&d=1392991331

The user will enter 119.99 and 69.99 and we would like the "-41%" to be calculated using a rule.

How may we do that ?

 

Using FP 9.1 and MarcomCentral.

Thanks for your help !

Olivier from France

Capturede769cran2014-02-21a76810_21_33.png.43939d48b676711d36b8eb9303929b11.png

Link to comment
Share on other sites

Please note I used the Math.ceil property since we are dealing with negative numbers.

 

var was = Int(Field("was price")); // 119.99
var now = Int(Field("now price")); // 69.99
var reduction = Math.ceil(((now - was) / was)*100) + "%";
return reduction;

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...