Text Blaze Feature of the Week #2: Formulas

Hey Text Blaze community :fire:

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

Text Blaze Feature of the Week #2: Formulas :heavy_equals_sign:

The formula command is one of the most versatile features that Text Blaze offer. This is because there are essentially limitless ways you can use them. Formulas help you with dynamic math, creating variables, and utilizing them in your snippets.

Three things to know about formulas:

  1. Formulas have the same syntax as other commands, however, there are two settings (positional and format) that make formulas different.
  2. You can use formulas to interact with the name setting in forms.
  3. The Formula Reference is extremely helpful if you want to include formulas in your snippets.

Note: Put the name of the variable before the formula command's = sign to create variables that can be reused in your snippets.

The snippet below is an example of how to do it.

Hey {formtext: name=name; cols=10}!

I hope you're doing well. Just wanted to check in and see if you wanted to meet up soon. Let me know!

Looking forward to hearing back from you, {=name}.

The snippet below is an example of how you can use formulas to interact with forms (as well as format your results).

Hello customer,

You ordered {formtext: name=quantity; default=5; cols=5} units, which cost ${formtext: name=price; default=5; cols=6} each.

This brings your total cost to: {=quantity*price; format=$,.2f}.

The snippet below shows how you can use formulas to interact with formmenus as well as dates.

{formmenu: name=window; Weekly; Monthly; Yearly; cols=15}
{weeks=1 if window=="Weekly" else (4 if window=="Monthly" else 52.18)}
total cost is {=weeks*20}

What do you think should be the next feature of the week? Let me know by commenting here or emailing me at dylan@blaze.today :smiley:


These are very helpful for people new to TB and even for someone whose been using it for a while, it's good to see some of the uses and best practices.

One of the things that has always fascinated me, not just in TB but in most programming tasks, is that of Regular Expressions.

I think a guide to using these dark arts would help a lot of people. They are one of the most powerful functions around.


Thanks Andy! That's the goal of the posts, and I'm glad you've found them helpful so far.

Thanks for the recommendation, I'll look into that :thinking:

1 Like