Skip to content

Rule Builder (Formerly Formula Constraints)

Introduction

The Rule Builder is a powerful tool for managing complex configuration logic within your configurator. It is composed of three main components:

ComponentDescription
Formula ConstraintsDefine conditions and effects for specific rules or logic within the configurator. Can reference Saved Expressions.
Formula Constraint CategoriesOrganizational tags or labels to group and categorize formula constraints for better management.
Saved ExpressionsReusable formulas or expressions that can be referenced across multiple formula constraints.

Formula Constraints

Formula constraints are the backbone of the logic in your configurator. They define when specific actions should occur and what should happen when those conditions are met.

Fields within Formula Constraints

FieldDescriptionDetails
NameThe name of the formula constraint.Used to identify the constraint easily.
DescriptionA markdown field to provide additional context or details about the constraint.Supports rich formatting for clarity and emphasis.
OrderingDefines the execution order for the formula constraint.Lower numbers run first.
Formula Constraint CategoriesAllows you to assign the constraint to one or more categories.Helps with organizing and grouping related constraints.

Building a Formula Constraint

Once the basic fields are inputted, you can begin defining the logic of the formula constraint. This logic consists of two main parts:

ComponentDescriptionDetails
ConditionsDefine the specific conditions that must be met to execute the constraint.Essentially defines when the constraint should run.
EffectsSpecify the actions or outcomes that occur when the conditions are satisfied.Essentially defines what happens when the constraint runs.

Next Steps

You can now elaborate further on Conditions and Effects, detailing their configurations, structure, and examples. This table-driven overview provides a foundation for more in-depth documentation.

Conditions

When building a condition in the Formula Constraint Builder, you define the logic that determines when specific effects should be executed. A condition can be constructed using one of three main approaches:

Options for Building a Condition

OptionDescriptionDetails
Build an ExpressionCreate a custom equation using operators and functions.See the list of available operators and functions below.
Condition on ValuesDefine conditions based on specific values or criteria (e.g., numbers, strings, user input).See the list of possible value-based conditions below.
Use a Saved ExpressionReference a previously created and saved expression for reuse.Enables consistency and efficiency by avoiding redundant logic.

Option 1: Build an Expression

When building an expression, you can utilize a variety of operators and functions to create complex conditions. Below is the complete list:

Operator/FunctionSymbolDescription
And&&Logical AND; returns true if both conditions are true.
Or`Logical OR; returns true if at least one condition is true.
Not!Logical NOT; negates the condition.
Xor^Logical XOR; true if only one of the conditions is true.
Add+Adds two values.
Sub-Subtracts one value from another.
Mul*Multiplies two values.
Div/Divides one value by another.
Mod%Returns the remainder of a division.
Pow^Raises a number to a power.
Tan-Calculates the tangent of a value.
Sin-Calculates the sine of a value.
Cos-Calculates the cosine of a value.
Atan-Calculates the arctangent of a value.
Asin-Calculates the arcsine of a value.
Acos-Calculates the arccosine of a value.
Avg-Calculates the average of a set of values.
Median-Calculates the median of a set of values.
Abs-Returns the absolute value of a number.
Round-Rounds a number to the nearest integer.
Ceil-Rounds a number up to the nearest integer.
Floor-Rounds a number down to the nearest integer.
Min-Returns the smallest value in a set.
Max-Returns the largest value in a set.
Lt<Less than.
Lte<=Less than or equal to.
Eq==Equal to.
Neq!=Not equal to.
Gt>Greater than.
Gte>=Greater than or equal to.

Option 2: Condition on Values

You can create conditions based on the following value types:

Value TypeDescription
NumberA numeric value to evaluate.
BooleanA true or false value.
StringA string (text) value to evaluate.
User LevelThe user’s role or level within the system.
Option SelectedWhether a specific option is selected.
QuantityThe quantity of a selected option.
PriceThe price of a selected option or configuration.
ValueA specific value within the configuration.
LengthThe length of a string or numerical value.
Num SelectedThe number of selected options.
Num OptionsThe total number of options available.
At Least One SelectedChecks if at least one option is selected.
All SelectedChecks if all options in a group are selected.
CountryThe user’s country.
Is UserValidates whether the condition pertains to a specific user.

Option 3: Use a Saved Expression

If a previously created Saved Expression fits your condition, you can directly reference it. This approach is highly flexible and efficient, as saved expressions can be used in two ways:

  1. Inside Formula Constraints: Incorporate saved expressions directly within the logic of your formula constraints to simplify complex equations.
  2. As Values: Use saved expressions as input values when building conditions to ensure consistency across the configurator.

Next Steps

You can now dive deeper into configuring Effects, or expand further on the specifics of building conditions. Let me know how you’d like to proceed!

Effects

The Effects section of the Formula Constraint Builder allows you to define the outcomes that occur when conditions are satisfied. Effects control the behavior of options, elements, and groups, providing powerful customization capabilities.

Key Features of Effects

  1. Change Order:
    • Specify the order in which effects are executed within a constraint.
    • Assign a priority (e.g., first, second, third) to determine the sequence of execution.
  2. Name and Description:
    • Assign a name to the effect for easy identification.
    • Provide a description using a markdown field for context or additional details.

Effect Configuration

Each effect within a constraint can be configured by selecting the appropriate Effect Type and its corresponding Target. Below is a comprehensive list of effect types and their functionalities:

Effect TypeDescriptionApplies To
ShowMakes an option, element, or group visible.Options, Elements, Groups
HideHides an option, element, or group, making it invisible in the configurator.Options, Elements, Groups
RequireMarks an element or group as mandatory.Elements, Groups
OptionalMarks an element or group as optional.Elements, Groups
ReadonlyDisables interaction with an option, element, or group while keeping it visible.Options, Elements, Groups
UnsetRemoves the value of an option or element.Options, Elements
SetAssigns a specific value (e.g., true for a boolean) to an option or element.Options, Elements
Set QuantitySets the quantity of an option or element based on a formula.Options, Elements
MessageDisplays a custom message to the user.

Useful for providing guidance or context in the configurator
Options, Elements, Groups
ErrorDisplays an error message when conditions are not met.

Ideal for enforcing critical rules.
Options, Elements, Groups
WarningDisplays a warning message when conditions might lead to issues but do not prevent further action.

Helps alert users without blocking progress.
Options, Elements, Groups
SuccessUseful for confirming that a configuration step was completed correctly.Options, Elements, Groups

How to Configure an Effect

  1. Select Effect Type:
    • Use the table above to choose the effect type that fits your configuration logic.
  2. Select Target:
    • Choose the specific option, element, or group that the effect will act upon.
  3. Set Parameters:
    • Depending on the effect type, you may need to input additional parameters (e.g., a formula for Set Quantity or a boolean for Set).