Create calculators that you can use anywhere

Hey Text Blaze community :fire:

It's week 9 of the Text Blaze Feature of the Week series where I post weekly about cool features to showcase all the awesome stuff you can do with Text Blaze :sunglasses:

Create calculators that you can use anywhere

Quickly inserting text is useful, but do wish you could do calculations within your snippets?

Instead of doing a Google search or pulling out your calculator, you can just use Text Blaze's formulas feature!

Formulas help you perform mathematical calculations as well as reuse form fields in snippets to help you save time.


Three things to know about formulas:

  1. To use a formula, go to your dashboard, click to edit a snippet, scroll down to "Dynamic Logic" on the commands menu, and click "Formula."

  2. Formulas can be used in addition to other Text Blaze commands (if) as well as functions (math, text, date, list, string, etc) to make them super powerful.

  3. You can format formula results in percentages, currency, thousands, and more.

Note: Check out our Formula Reference for more information.

Example 1: Quickly calculate costs for an invoice

This snippet reuses form fields to quickly calculate a pricing and generate an invoice for a customer.

Dear {formtext: name=customer; default=John; cols=8},

Thank you for your order of: {formtext: name=quantity; default=25; cols=5} units.

The price of each unit is: ${formmenu: name=price; 12.00; default=24.00; 48.00}.

The pre-tax total is: {=price*quantity; format=$,.2f}.

Thank you again for your order {=customer}.


Example 2: Send an automated message to a customer

This snippet utilizes formulas, a date field, text fields, and the if command to automatically provide information regarding a customer's subscription and renewal options.

Hey {formtext: default=John; name=clientname; cols=8},

I see that your subscription is set to end on {formdate: YYYY-MM-DD; default={time: YYYY-MM-DD; shift=+7D}; name=subdate}.

Are you interested in renewing your subscription?

If you renew before {time: MMMM Do, YYYY; at={=subdate}}, I can offer you a discounted price of ${formtext: name=price; default=10.99; cols=7} per month, which would be {=price*12; format=$,.2f} for the first year.

{if: datetimediff({time: YYYY-MM-DD}, subdate, "D")<7}You have less than a week to renew. Don't miss out on discounted renewal pricing!{else}You still have some time, but it's not too early to think about renewing!{endif}


Example 3: BMI calculator

This snippet helps you quickly calculate BMI using formulas.

Weight {formtext: name=weight; default=150; cols=5} lbs.
Height: {formtext: name=feet; cols=2; default=5}'{formtext: name=inches; cols=2; default=8}

BMI: {=703 * (weight / (feet * 12 + inches)^2); format=,.2f}

{if: (703 * (weight / (feet * 12 + inches)^2)) > 25}This score indicates that a person is overweight. {elseif: (703 * (weight / (feet * 12 + inches)^2)) < 18.5}This score indicates that a person is underweight.{else} This score indicates that a person is a normal weight.{endif}

Example 4: Automatically grade assignments

This snippet quickly calculates the grade for an assignment with each criteria's grade also being listed.

Here is your grade:

Accuracy: {formtext: name=Accuracy}/10
Grammar: {formtext: name=Grammar}/10
Citations: {formtext: name=Citations}/10
Content: {formtext: name=Content}/10
Total: {=accuracy + grammar + citations +content}/40