Logo Text Blaze
  • Products
    • Text Blaze
      Snippets and templates
    • AI Blaze
      AI writing and editing
    • Data Blaze
      Tables and sheets
    Downloads
    • Add to Chrome
    • Windows app
    • MacOS app
  • By function
    • Support & operations
    • Sales
    • Healthcare
    • Education
    • Recruiting
    • Marketing
    Business
    • For teams
  • Resources
    • Documentation
    • Community forum
    • Gallery
    • Contact us
  • Pricing
Documentation
No search results
Text Blaze
Loading...
Data Blaze
Loading...
Community Forums
Loading...
Add to Chrome –  It's Free! Go to Dashboard ›
Docs > Guides
  • Guides
    • Quick Start
    • Sharing Snippet Folders
    • Dynamic Commands
    • Date and Time
    • Autopilot
    • Forms
    • Formulas
    • Rules & Validation
    • Tables in Snippets
    • Connect Other Apps
    • Tidying Whitespace
    • Lists
    • Read Data from Websites
    • Teams and Organizations
  • Tutorial Videos
  • Gallery
  • Frequently Asked Questions
  • Formula Reference
  • Dynamic Commands
    • Using Dynamic Commands
    • {=} (Formula Command)
    • {button}
    • {click}
    • {clipboard}
    • {cursor}
    • {error}
    • {formdate}
    • {formmenu}
    • {formparagraph}
    • {formtext}
    • {formtoggle}
    • {if}
    • {import}
    • {key}
    • {link}
    • {note}
    • {repeat}
    • {run}
    • {site}
    • {snippet}
    • {time}
    • {user}
    • {wait}
  • Connected Snippets
    • Connected Snippets Overview
    • {image}
    • {urlload}
    • {urlsend}
    • {dbselect}
    • {dbinsert}
    • {dbupdate}
    • {dbdelete}
  • Command Packs
    • Capitalize
    • Gmail
    • LinkedIn
    • Randomize

What's on this Page

  • Using the values of other fields with a formula
    • Re-using the value exactly as it was entered
    • Modifying the value when re-used
  • Performing calculations using formulas
    • Using operators for simple calculations
    • Functions inside Formulas
    • Nesting multiple functions inside a formula
    • Combining functions and operators
  • Defining variables
    • Using variables you’ve created
Guides

Using Formulas in Snippets

Summary: Formulas in Text Blaze enable you to perform calculations. They allow you to do math in your snippets, re-use the values of other form fields, create your own variables, transform text in a variety of ways and much more.

Quick Overview Video

At its most basic, formulas can complete static, unchanging math, such as {=10*5} or {=3+3}. Formulas become much more powerful when they interact with other fields within your snippet.

Using the values of other fields with a formula

Re-using the value exactly as it was entered

One of the most popular uses of the formula command is to re-use a value that has already been defined through another field. For instance, if a snippet contains a text field that is used for someone’s first name, a formula can display that first name again without needing to retype it:

Sample

Hi {formtext: name=firstname}

I can re-use what I entered in as your name above with a formula field: {=firstname}.

I simply create a formula that uses the name of that other field only. I can re-use that value as much as I’d like, so here it is again: {=firstname}.

_

To easily create formulas that re-use other values, find the Formula option in the list of dynamic commands on the right side of the Text Blaze dashboard. Any fields already in the snippet that have been given a name will be available:

Existing fields are also listed at the top of the Forms section of the dynamic commands list

Modifying the value when re-used

As seen above, I can re-use a value exactly as it was entered into another field. Beyond that, I can use formulas to manipulate and change the original value into something new.

In the example below, the formula command is multiplying whatever number I enter into the formtext field called “amount” by 10:

Sample
Enter the amount: {formtext: default=5; name=amount} The amount multiplied by 10 is {=amount*10}
_

This snippet’s formula will dynamically calculate that amount for any number entered into the field called amount.

Performing calculations using formulas

Using operators for simple calculations

Operators are used to create your formula, and define what the formula does. Which operators go into your formula depends on what you want your formula to do, and what kind of data it’s interacting with. Your formula may contain multiple operators as it gets more complex.

Math operators power formulas that interact with numbers. Text Blaze uses the most common operators that you might be familiar with from other applications, like Excel or Google Sheets. Those are +, -, /, *, and ^. Additional details about math operators is available here.

Comparison and logical operators allow you to evaluate if a statement is true or false (e.g. 10 > 5). They are primarily used for rules (the if/else command). More information about these types of operators can be found here

Sample
Enter a number: {formtext: default=5; name=number} Is the number greater than 10? {=number>10}
_

Functions inside Formulas

Text Blaze also includes a wide variety of built-in Functions to use within formulas. A built-in function is a contained piece of functionality designed to perform a particular task as part of a formula.

One example of that might be the round function:

Sample
Enter the amount: {formtext: default=3.14159; name=amount} That amount rounded to the nearest whole number is {=round(amount)}
_

Some functions, especially text/string functions, contain a second setting which must be defined when creating the formula. For instance, the left function requires indicating how many characters from the left should be retrieved:

Sample
{formtext: default=Text Blaze User; name=yourname} The first 4 letters entered into that text field are: {=left(yourname, 4)}
_

Nesting multiple functions inside a formula

A single formula can contain multiple functions, completing many actions at once. Nesting can be done with both math and text/string functions.

Sample

Enter the text you want to be put into uppercase and reversed: {formtext: default=text goes here; name=original}

Here’s that text in uppercase and reversed: {=upper(reverse(original))}

_
Nested functions are nested inside parenthesis and will be evaluated from the inside to the outside.

Let’s see how the order of the functions within a formula changes the results:

Sample

In this example, there is a square root function nested into a round function. Since the square root function is inside of the round function, that will be calculated first, and then its result will be rounded:

Square root first, then round the results: {=round(sqrt(44.5))}

If the function order is reversed, we receive a different result. Below, 44.5 is rounded first and then the squareroot of the rounded number is calculated:

Round first, square root second: {=sqrt(round(44.5))}

_

Combining functions and operators

Functions and operators can be used together inside of a single formula. Simply write the formula using both:

Sample

This snippet is a simple division calculator which rounds the result.

Enter the original amount: {formtext: default=48632; name=amount}

Enter how much you’d like to divide that amount by: {formtext: default=7; name=divisor}

Here is the result: {=round(amount/divisor)}

I can also do that with static amounts, such as: {=round(14245/9)}

_

Defining variables

As seen throughout this guide, variables are commonly defined by giving a form field a name, and then using that name as a placeholder for its value.

This is seen in the previous example where ”amount” and ”divisor” are names applied to text fields, and then those names are used in formulas.

You can also define variables "manually". To create a variable, you’ll need to write it out inside of your snippet. The variable will need a name, and it will need a value.

To define your variable, use this format: {variable_name=value}.
This definition portion of the snippet will not be shown in the final generated text.

Using variables you’ve created

Variables created through assignment mode can be used just like any other variable, by referring to its name in other formulas.

Sample

Here I am defining a variable called "target" with the value of 100: {target=100}

Now I am defining a variable called "intro" with some text as the value: {intro="This text will be displayed where I use the intro variable"}

Once defined, I can use them in my snippet like any other variable:

{=3000/target}

{=concat("Hi Text Blaze User. "&intro)}

_

About

Plans and Pricing
Sharing Snippets
Text Blaze for Business
Forms
Autopilot
Dynamic Commands
Command Packs
Text Blaze for Windows
Text Blaze for macOS

Support

Get Started with Text Blaze
Contact Us
Documentation
Community Forum
Blog
Gallery
Engineering Blog

Solution for

Business
Customer Support
Recruiters
Education
Healthcare
Sales
Property Managers
AI

Other

Privacy Policy
Terms of Service
Open Source Licenses
Affiliate
© Blaze Today Inc