Dynamic Values
Your tax rate appears in twelve rules. When it changes from 8% to 8.5%, do you want to update twelve rules—or one value?
Dynamic Values solve this problem for you by storing numbers, strings, and other data types centrally. Reference them in any rule, and update them in one place.
Changes to values propagate instantly, and using values doesn't detract from how performant your rules are because values are deeply integrated into our caching infrastructure.
Ad-hoc values
Create a value
Go to Team → Values and click Create New Value.

Fill in the value's details

Use it in a rule
In the rule editor, click a condition or result cell. Toggle to variable mode and select your value from the dropdown.
Note that you'll only see your value if it's the right type of data for the operator the cell is using. For example, if your operator is "Greater than", then you'll only see your Values of type number.

Bulk importing
You'll often want to bring in a large number of values at once to start using vocabulary from your business right away. Rulebricks offers you three ways to do this quickly.
First, our values UI allows you to simply import large, potentially nested JSON dictionaries that simply contain key value pairs.
Use the "From JSON" tab to continue with this option.

Second, an API endpoint is also available to create and update dynamic values. Start by looking at our Dynamic Values API (opens in a new tab).
Finally, if you have JSON Schema on hand, or even a DDL or other similar schema artifact, you can upload your schema as an Object (or use smart import if you're bringing a DDL/non-standard format). Rulebricks will automatically scan your schema for enums/ranges, and create values based on them in your workspace.
Functions
Functions let you write JavaScript that computes results dynamically, calculating results based on input and other output values.
Functions can be authored here as arrow expressions. Some libraries are available to assist with complex operations.
((quantity, price) => (quantity > 100 ? price * 0.9 : price))Create a function
Go to Dashboard → Values and click Create New Value – functions are just a kind of Dynamic Value.
Select the function type, and write in a JavaScript arrow expression.
Use it in a rule
Add a Function type column to your rule's response, or update an existing column's type accordingly. Type $ to see available functions, including the one you've just made.
