Guide to Writing Computations in SpotDraft
Last updated: February 13, 2026
The Computation Builder allows you to perform calculations and automate logic directly within your contracts. Whether you need to calculate a Total Contract Value, determine a renewal date, or set approval conditions based on deal size, this tool enables you to do so without needing a technical background.
This guide covers the fundamentals of data types, arithmetic operations, and logical functions to help you get started.
1. Understanding Data Types
Before writing formulas, it is important to understand how SpotDraft categorizes information. Every variable in your contract has a specific Data Type. To prevent errors, the system ensures that mathematical operations are performed on compatible types.
Number: Standard integers or decimals (e.g., 10, 500, 2.5).
Currency: Monetary values (e.g., $100.00, €50).
Duration: A span of time (e.g., 30 Days, 12 Months).
Date: A specific calendar date (e.g., 2024-01-01).
Text- box: Text-based information (e.g., "MSA", "Active").
Boolean: A True/False condition.
General Rule: Most operations require matching data types (e.g., adding Currency to Currency). However, there are specific exceptions, such as adding a Duration to a Date, which are detailed below.
2. Arithmetic Functions
These functions allow you to perform mathematical calculations on your contract data.
Addition: Add
Used to sum values or project future dates.
Syntax: Add(value1, value2)
Supported Operations:
Number + Number: Standard addition.
Currency + Currency: Adds monetary amounts (Must be the same currency code).
Date + Duration: Moves a date forward (e.g., Start Date + 30 Days = End Date).
Duration + Duration: Combines two time periods.
Incompatible: Adding Currency to Duration or Date to Number is not supported as these represent incompatible dimensions.
Subtraction: Subtract
Used to calculate differences, remaining balances, or past dates.
Syntax: Subtract(value1, value2)
Supported Operations:
Number - Number: Standard subtraction.
Currency - Currency: Calculates the difference between amounts.
Date - Duration: Moves a date backward (e.g., Expiration Date - 30 Days = Notice Date).
Date - Date: Calculates the time elapsed between two dates (Returns a Duration).
Incompatible: Subtracting Currency from a Number is not supported.
Multiplication: Multiply
Used to scale values, such as calculating total costs based on quantity.
Syntax: Multiply(value1, value2)
Supported Operations:
Currency × Number: Scales a monetary amount (e.g., Monthly Fee × 12).
Duration × Number: Scales a time period (e.g., 1 Week × 4).
Number × Number: Standard multiplication.
Incompatible: Multiplying Currency by Currency or Date by Number is not supported as these result in undefined units.
Division: Divide
Used to split costs, find averages, or determine ratios.
Syntax: Divide(value1, value2)
Supported Operations:
Currency ÷ Number: Splits an amount (e.g., Total Fee ÷ 4 Installments).
Currency ÷ Currency: Determines a ratio (Returns a Number).
Duration ÷ Duration: Determines a ratio (Returns a Number).
Incompatible: Dividing a Number by Currency or performing division on a Date is not supported.
3. Math Helper Functions (Rounding & Remainders)
When calculations result in precise decimals, these functions help standardize the output.
4. Comparison Functions (Logic)
Comparison functions allow you to ask questions about your data. These functions always return a Boolean (True or False) result, which is essential for setting up approval workflows or conditional clauses.
Greater Than / Less Than
Checks if one value exceeds or falls short of another.
Syntax: GreaterThan(value1, value2) or LessThan(value1, value2)
Usage:
GreaterThan(ContractValue, 10000) → Returns True if value is over 10,000.
LessThan(TermLength, 365) → Returns True if duration is under 365 days.
Note: Ensure you compare matching types (e.g., Currency vs. Currency). Comparing Currency to Duration is invalid.
Equals
Checks if two values are identical.
Syntax: Equals(value1, value2)
Usage: Equals(Region, "North America")
Not
Inverses a condition.
Syntax: Not(condition)
Usage: Not(Equals(Status, "Active")) → Returns True if the status is anything other than "Active".
5. Advanced Logic
These functions allow your computations to make decisions or handle missing data automatically.
If (Conditional Logic)
This function checks a condition and returns one of two possible results.
Syntax: If(Condition, Result_If_True, Result_If_False)
Example:
Scenario: If the Deal Value is over $50k, set the approval level to "Director". Otherwise, set it to "Manager".
Formula: If(GreaterThan(DealValue, 50000), "Director", "Manager")
IfExists (Fallback Values)
This function prevents errors if a user leaves a field blank by providing a default backup value.
Syntax: IfExists(Variable, Default_Value)
Example: IfExists(Discount, 0)
Logic: If the user entered a discount, use that number. If the field is empty, calculate using 0.
Switch (Multiple Scenarios)
Use this when you need to check a variable against a list of potential values (similar to multiple If statements).
Syntax: Switch(Variable, Case1, Result1, Case2, Result2, DefaultResult)
Example: Setting contract terms based on the selected Plan Type.
Switch(PlanType, "Gold", "3 Years", "Silver", "2 Years", "1 Year")
Logic: If Plan is Gold, result is 3 Years. If Silver, result is 2 Years. For any other plan, result is 1 Year.
6. Quick Reference: Valid Operations
Use this table to quickly check if an operation is supported between two data types.
Best Practices for Operations:
Currency and Duration: Adding Currency to Duration (e.g., $500 + 30 Days) is not supported as the units are incompatible.
Currency Multiplication: While you can multiply Currency by a Number (e.g., $10 * 5 units), multiplying Currency by Currency is not supported.
Date Operations: You cannot add two dates together (e.g., Jan 1st + Jan 1st). However, you can add a Duration to a Date to project a future timeline.