Unlock Powerful New Capabilities with Documint’s Calc Function
What is the Calc Function?
We’re excited to introduce our brand new Calc Function, now in beta. Designed to make your document workflows more powerful, this function lets you perform arithmetic operations directly within your templates.
Accessible using the {$calc} syntax, this function can help simplify a wide variety of tasks. It can handle mathematical calculations, text transformations, array manipulations, and conditional logic. From dynamically adjusting prices to formatting text or evaluating complex conditions, the Calc Function brings even more capabilities to Documint.
Learn more about how to use the Calc Function in our documentation.
Key Capabilities of the Calc Function
- Automate Complex Calculations
With support for arithmetic operations and advanced math functions, the Calc Function can perform:
- Basic Operations: Addition, subtraction, multiplication, division, and modulo operations.
- Advanced Math: Functions like absolute value, maximum/minimum, power, square root, rounding (up, down, nearest), and more for sophisticated math needs.
- Statistical Calculations: Calculate averages, medians, or sums of values—perfect for generating reports or summaries.
- Manipulate Text with String Operations
Easily handle text formatting and transformations within templates:
- Text Transformations: Convert strings to lowercase or uppercase, trim whitespace, concatenate strings, extract substrings, and replace parts of a string.
- Variable Interpolation: Reference context variables dynamically to apply these transformations to your data fields.
- Leverage Array Operations for Enhanced Data Processing
The Calc Function offers an array of tools to create and manipulate collections:
- Array Creation and Manipulation: Create arrays, get the first or last element, count items, join elements, split strings, and sort or reverse arrays.
- Flexible Output: Use these functions to dynamically build lists or tables in documents.
- Conditional Evaluations with Boolean Logic
Control document flow with conditional logic for calculations and outputs:
- Booleans and Conditionals: Evaluate conditions directly in your template, making it possible to dynamically alter content based on criteria.
- Error Handling: Add custom error messages for calculations to manage edge cases (e.g., dividing by zero).
- Customizable Formatting Options
Make calculations and outputs clear and professional with formatting options:
- Decimal Control: Specify the number of decimal places for precision.
- Custom Formats: Apply currency formats, percentage displays, or other patterns to match your document style.
- Store Intermediate Calculations for Reuse
Save calculations with the $var function and reference them later in the template to streamline complex processes:
- Reusable Variables: Define intermediate results and use them multiple times, allowing you to build layered calculations and reduce repetition.
Real-World Applications
The Calc Function is designed to make life easier for anyone dealing with dynamic data in documents. Here are some examples of how it can streamline common workflows:
- Invoicing and Billing: Automatically calculate taxes, discounts, and totals with complex pricing rules.
- Sales and Proposals: Dynamically adjust pricing for quotes based on customer data, apply conditional discounts, and format prices in local currency.
- Financial and Operational Reports: Summarize, aggregate, or format data for reports, such as calculating quarterly averages or generating summaries.
- Contracts and Orders: Use arrays and conditionals to dynamically update quantities, fees, or other variables for more personalized and accurate documents.
Getting Started
The Calc Function is currently available in beta, and it’s easy to start integrating it into your Documint templates. Visit our documentation for detailed guidance on setting up and configuring this powerful feature.
We Want Your Feedback!
As this feature is in beta, we’d love to hear your feedback! Your insights help us refine and expand the Calc Function to fit your real-world needs. Whether you have suggestions, requests, or just want to share how you’re using it, your feedback is invaluable.
The Calc Function is your new toolkit for making your documents smarter, faster, and more responsive. Start exploring it today and see how this powerful feature can transform your workflow.
More stories for you
How FP Complete saves about 2 weeks' worth of time by using Documint
Meet Nick
Nick Ferguson is the VP of Platform Engineering and Cloud Enablement at FP Complete. Thefalse
How a charter school uses Documint to automate all their paperwork
Meet Helen
Behind every well-organized school is hardworking administration holding it up. Andfalse
How Documint changed the way Kitchen Magic generates customer letters and run sheets
Meet Alex
Alex Teran has been a backend developer with Kitchen Magic for 5 years. Over the 5 years,false