Blog

Using conditions in your calculations

Posted by:

You are here:
< Back

You can also do conditions in your formulas using this format:

if( condition) //Price or calculation that you want to use

So for example, lets say that you have a drop down called “Subscription type” with two options “Yearly Subscription” and “Monthly Subscription”

With the annual subscription you give a 20% discount, so you will have two calculations, one with the discount and one without the discount. So your formula would look like this

With this formula if the user select “Monthly Subscription” the price will be just the product price (without any additional discount) but if “Yearly Subscription” is selected the product price will be multiplied by 0.8 (which effectively adds a 20% discount).

Type of conditions

You can do these types of comparisons using conditions

SymbolNameDescriptionExample
==Equal toCompare that a value is equal than another value[Field 1] == [Field 2]
!=Not Equal To Compare that a value is not equal than another value [Field 1] != [Field 2]
>Greater thanCompare that a value is greater than another [Field 1]>[Field 2]
>=Greater or equalCompare that a value is greater or equal than another[Field 1]>=[Field 2]
<Less thanCompare that a value is less than another[Field 1]<[Field 2]
<=Less or equal thanCompare that a value is less or equal than another[Field 1]<=[Field 2]
ContainsContainsCompare that a value is inside a list of values (frequently used for multiple options fields like radio buttons or check boxes fields)[Field 1] contains [Field 2]
not containsNot Contains Compare that a value is not inside a list of values (frequently used for multiple options fields like radio buttons or check boxes fields) [Field 1] not contains [Field 2]

0

About the Author:

Im programmer working for an international company. I have programmed since i was 12 and i have done it professionally for 6 years. Programming for a company is fun and i have learned a lot of things but i have always been interested in running my own business so i decided to give it a shot doing what i do best, programming stuffs.
  Related Posts
  • No related posts found.