Difference between revisions of "Order Express Formulas"

From eVision
Jump to: navigation, search
(Excludes X of Y)
(Excludes)
Line 342: Line 342:
 
Format: <code>[atoms]~<X>~[excluded_atoms]</code>
 
Format: <code>[atoms]~<X>~[excluded_atoms]</code>
  
If any <code>[atoms]</code> are matched, <code>[excluded_atoms]</code> are excluded. The inverse is also true, if any <code>[excluded_atoms]</code> are matched, <code>[atoms]</code> are excluded.
+
If any <code>[atoms]</code> are selected, <code>[excluded_atoms]</code> are excluded. The inverse is also true, if any <code>[excluded_atoms]</code> are matched, <code>[atoms]</code> are excluded.
  
 
=== Excludes X of Y ===
 
=== Excludes X of Y ===

Revision as of 11:55, 21 January 2015

Overview

Order Express utilizes a robust expression system designed by eVision Services which allows for the conditional availability and pricing and of items. These formulas are stored within the database in the Formulas, PricingRules, FinalValidationRules and StyleOptionRules table. Rules are written in postfix notation, but includes a number of keywords that can be used to retrieve information about the item being evaluated or priced (such as how a product can be priced differently based on which styles are applied to it).

Valid Keywords / Tokens

These keywords are considered to be "valid" keywords/tokens within the Rules Engine. Each of the keywords are shown as links which will take you to their usage instructions.

Usage

Aggregation

Tokens: COUNT:(), MAX:(), MIN:(), SUM:()

Count

Tokens: COUNT:, (, ,, )

Format: COUNT:([atoms]) or COUNT:[count_greater_or_equal_to]([atoms])

The value for [atoms] is a comma separated list of atoms to test against. Returns the number [atoms] that return true. The value of [count_greater_or_equal_to] changes the return type of this atom into a boolean, where the result is true if the number of [atoms] is greater or equal to the value supplied.

Maximum Value

Tokens: MAX:, (, ,, )

Format: MAX:([atoms])

The value for [atoms] is a comma separated list of atoms of which to find the largest value.

Minimum Value

Tokens: MIN:, (, ,, )

Format: MIN:([atoms])

The value for [atoms] is a comma separated list of atoms of which to find the smallest value.

Summation

Tokens: SUM:, (, ,, )

Format: SUM:([atoms])

The value for [atoms] is a comma separated list of atoms to add together.

Categories

Tokens: C:, S:

Product and Modification Categories

Tokens: C: or Category:

Format: C:[product_category_display_id] or C:[modification_category_display_id]

The value for the [product_category_display_id] parameter should match the ProductCategoryDisplayID in the ProductCategories table. The value for the [modification_category_display_id] parameter should match the ModificationCategoryDisplayID in the ModificationCategories table.

Style Option Categories

Tokens: S: or StyleOptionCategory:

Format: S:[style_option_category_display_id] or S:[style_option_category_name]

The value for the [style_option_category_display_id] parameter should match the StyleOptionCategoryDisplayID in the StyleOptionCategories table. The value of [style_option_category_name] should match the Name in the StyleOptionCategories table.

Conditionals

Tokens: EVERY:, I:, LIMIT:, SOME:

Every Condition

Tokens: EVERY: or ALL:, (, ,, )

Format: EVERY:([atoms])

The value for [atoms] is a comma separated list of atoms to test against. Returns true if all of the atoms test true.

Conditional Expressions

Tokens: I: or Conditional:, =>, ,

Format: I:[conditional]=>[expression_if_true],[expression_if_false]

Conditional expressions are defined using the above tokens. When these tokens are found within the expression, the expression is split into multiple parts. The [conditional] parameter is always executed to determine if it evaluates to a true or false value. If this evaluates to true, the [expression_if_true] parameter is executed. If it evaluates to false, the [expression_if_false] parameter is executed.

Limits

Tokens: LIMIT:, (, ,, )

Format: LIMIT:([atoms]) or LIMIT:[maximum]([atoms])

The value for [atoms] is a comma separated list of atoms to test against. The value of [maximum] indicates the threshold at which the result will be true (greater than [maximum]). If no [maximum] is supplied, it is assumed 0.

Some Conditions

Tokens: SOME: or ANY:, (, ,, )

Format: SOME:([atoms])

The value for [atoms] is a comma separated list of atoms to test against. Returns true if any of the atoms test true.

Constants

Tokens: X: or Constant:

Format: X:[constant_name]

Used to obtain the value of constant. The value for the [constant_name] parameter must match the ShortName column in the Constants table.

Boolean

Tokens: None

Format: [boolean]

The value must be a string representation of a boolean. Valid values are true or false (case-insensitive).

Decimal

Tokens: X:, Constant: or None

Format: X:[decimal] or [decimal]

The value must be a string representation of a number.

String

Tokens: X:, Constant: or None

Format: X:"[string]" or "[string]"

The value can be any string (enclosed in double quotes).

Modifications

Tokens: D: or Modification:

Format: D:[modification_display_id] or D:?

The value for the [modification_display_id] parameter should match the ModificationDisplayID in the Modifications table. If the current item being evaluated is a modification, the value returned will be true if the modification's display id matches. If the current item being evaluated is a product, the value returned will be true if the product has a modification attached to it where the modification's display id matches. The format D:? is the equivalent of asking if the current item being evaluated is a modification.

Modification Product

Tokens: D:P:, D:P:D:, Modification:Product: or Modification:Product:Modification

Format: D:P:[product_display_id] or D:P:D:[modification_display_id]

The value for the [product_display_id] parameter should match the ProductDisplayID in the Products table. The value returned will be true if the modification being evaluated is attached to a product with a matching display id. The format D:P:D:[modification_display_id] is the equivalent of asking if the modification that is being evaluated is attached to a product that with a matching modification display id.

Modification Product Tags

Tokens: D:P:T: or Modification:Product:Tag:

Format: D:P:T:[tag_name]

Used to determine if the modification is attached to a product that is tagged as the value specified in the [tag_name] parameter.

Modification Product Categories

Tokens: D:P:C: or Modification:Product:Category:

Format: D:P:C:[product_category_display_id]

Used to determine if the modification is attached to a product that is included in the category as specified by the value of the [product_category_display_id] parameter.

Nested Formulas

Tokens: F: or Formula:

Format: F:[parameter]

Executes the pricing rule with a name of [parameter]. This is primarily used in conjunction with the conditional operators, or to split expressions into shorter pieces.

The value for [parameter] should match PricingRuleLabel.

Pricing and Upcharges

Tokens: R:, U:, M:

Prices

Tokens: R: or Price:

Format: R:[price_type] or R:[pricing_rule_label]

Used to obtain the price for the current item. Only four values are valid for the [price_type] parameter. These values are BOOK, LIST, PREMIUM or BASE. If [pricing_rule_label] is supplied, it executes the pricing rule with a name of [pricing_rule_label]. The value for [pricing_rule_label] should match PricingRuleLabel.

Upcharges

Tokens: U: or Upcharge:

Format: U:[style_option_category_short_name]

Used to obtain the price of an upcharge for the style option category that matches the [style_option_category_short_name] parameter for the current item. The value for the [style_option_category_short_name] must match the ShortName column in the StyleOptionCategories table.

Variable Price Codes

Tokens: M: or VariablePriceCode:

Format: M:[variable_code]

Used to obtain the price for the current item. The value specified for the [variable_code] parameter is used, alongside the current price group, to obtain the price for the current item. The value for the [variable_code] parameter must match the Code column in the OEVariablePriceCodes table.

Products

Tokens: P: or Product:

Format: P:[product_display_id] or P:?

The value for the [product_display_id] parameter should match the ProductDisplayID in the Products table. The format P:? is the equivalent of asking if the current item being evaluated is a product.

Product Modifications

Tokens: P:D: or Product:Modification:

Format: P:D:[modification_display_id] or P:D:?

The value for the [modification_display_id] parameter should match the ModificationDisplayID in the Modifications table. The value returned will be true if the product being evaluated has a modification attached to it where the modification's display id matches. The format P:D:? is the equivalent of asking if the current product has any modifications attached to it.

Product Modification Categories

Tokens: P:D:C: or Product:Modification:Category:

Format: P:D:C:[modification_category_display_id]

The value for the [modification_category_display_id] parameter should match the ModificationCategoryDisplayID in the ModificationCategories table. Returns true of the product being evaluated has any modifications attached to it which match the specified modification category.

Specials

Tokens: A: or Special:

Format: A:?

The format A:? is the equivalent of asking if the current item being evaluated is a special.

Style Options and Selections

Tokens: O:, Q:, N:

Style Options

Tokens: O: or StyleOption:

Format: O:[style_option_display_id] or O:[style_option_tag_name]

The value for the [style_option_display_id] parameter should match the StyleOptionDisplayID in the StyleOptions table. The value of [style_option_tag_name] should match the StyleOptionTag in the StyleOptionTags table.

Style Option Selections

Tokens: Q: or StyleOptionSelection:

Format: Q:[style_option_display_id] or Q:[style_option_tag_name]

The value for the [style_option_display_id] parameter should match the StyleOptionDisplayID in the StyleOptions table. The value of [style_option_tag_name] should match the StyleOptionTag in the StyleOptionTags table. Functionally equivalent to the O: token, with the exception of when evaluating Style Option Rules, will check all products on the quote for the selected style.

Style Option Selection Count

Tokens: N: or StyleOptionSelectionCount:

Format: N:[style_option_category_display_id] or N:[style_option_category_name]

The value for the [style_option_category_display_id] parameter should match the StyleOptionCategoryDisplayID in the StyleOptionCategories table. The value of [style_option_category_name] should match the Name in the StyleOptionCategories table.

Tags

Tokens: T: or Tag:

Format: T:[tag_name]

Used to determine if the current item is tagged as the value specified in the [tag_name] parameter.

Variables

Tokens: V:, W:

Product Variables

Tokens: V: or Variable:

Format: V:[variable_code]

Used to obtain the value of a product variable for the current item. The value for the [variable_code] parameter must match the VariableCode column in the OEVariables table.

Modification Variables

Tokens: W: or ModificationVariable:

Format: W:[variable_code]

Used to obtain the value of a modification variable for the current item. The value for the [variable_code] parameter must match the VariableCode column in the OEVariables table.

Formulas

Used to validate the availability of modifications, finished ends, hinging, and so on.

Final Validation Rules

Used to validate a quote before its status is changed to submitted. The F: token uses the Formulas table.

Pricing Rules

Used to calculate pricing. The F: token uses the PricingRules table.

Style Option Rules

Used in evaluating the availability of style options.

Excludes

Tokens: <X>

Format: [atoms]~<X>~[excluded_atoms]

If any [atoms] are selected, [excluded_atoms] are excluded. The inverse is also true, if any [excluded_atoms] are matched, [atoms] are excluded.

Excludes X of Y

Tokens: < >

Format: [atoms]~<[count]>~[additional_atoms]

If [count] or more [atoms] and or [additional_atoms] are selected, [atoms] and [additional_atoms] are excluded.

Formula

Tokens: <F>

Format: [style_selection_atoms]~<F>~[formula]

The F: token uses the Formulas table.