# Using Logic in your Pricing Templates

#### Learn how to add if/then logic to your products within shopVOX

Here is a list of what operators that can be used in "Item Formula" and "Filters".

Numeric Pricing Attributes in Filter Field

Now you can use the "Numeric" Attributes in the Filter field to evaluation to a Boolean value of Yes/No and not just in Item Formula.

Example:If you have a numeric pricing attribute called "Sides", in the filter field you can add this logical expression

Sides > 1

And if the Sides value you entered is 2, then the above filter will return "True".

Conditional (Ternary) Operator

Now you can use a form of  if / then / else in Item Formula fields and the syntax is like below.

(Sides > 1) ? 2 : 1;

Where "Sides" is a numeric attribute and if that condition is true, then the value is 2 if not 1

Arithmetic Operators:

Comparison and Logical Operators:

Assignment Operators:

#### Math Methods:

• Math.round(x) - Rounds x to the nearest integer
• Math.abs(x) - Returns the absolute value of x
• Math.ceil(x) - Returns x, rounded upwards to the nearest integer
• Math.exp(x) - Returns x, rounded upwards to the nearest integer
• Math.floor(x) - Returns x, rounded downwards to the nearest integer
• Math.max(x,y,z,...) - Returns the number with the highest value
• Math.min(x,y,z,...) - Returns the number with the lowest value
• Math.pow(x,y) - Returns the value of x to the power of y
• Math.trunc(x) - Returns the integer part of a number (x)

#### Other System Variables:

• Area - You can add this to your pricing attributes in a Pricing Template.
>>>  These two have special behaviors.  Because if you have a material with perimeter as its formula definition then this value will override what ever that perimeter calculation comes to.  Same with Area, if you add this as a "Pricing attribute" to your pricing template what ever value is entered here will supersede the height*width calculate value.
Generally Area is used as a pricing attribute when you calculate Products like vehicle wraps etc., where you want to charge for the total area of different panels put together.
• svItem_sheet_height
>>>  this variable will return what ever the height of the material is that you picked to do some math in item formula field in pricing templates of shopVOX
• svItem_sheet_width
>>>  this variable will return what ever the width of the material is that you picked to do some math in item formula field in pricing templates of shopVOX.
•  svLineItem_qty
>>>  this variable will return the current line item qty, which can be used to do some calculations like roundup or so.