# August Development Update

We're thrilled to share some of the newest features and enhancements we've added to Text Blaze. We think you're going to love them as much as we do!

## Announcing the {button} and {run} Commands

We're constantly in awe of the advanced logic many of you incorporate into your snippets. With commands like {if}, {repeat}, and the formula command, you can create incredibly dynamic snippets.

But we know there have been a few hurdles when you're trying to craft those really intricate interactions. So, we're super excited to announce two new commands and additional capabilities that will help you overcome these challenges and create even more powerful snippets that are also easier to build and maintain.

### {button} Command

The new {button} command lets you add a button to your snippet that triggers a formula when clicked.

Here’s a fun example—a simple counter that tracks how many times you've clicked the button:

Click count: {formtext: name=count; default=0}
{button: count = count + 1; label=Click me!}

### {run} Command

The new {run} command executes a formula once, which is perfect for setting initial values. For instance, we could streamline our previous example, by using {run} to initialize the counter to 0:

{run: count = 0}
Click count: {=count}
{button: count = count + 1; label=Click me!}

### Code blocks

To fully leverage the {button} and {run} commands, we're also introducing Code blocks. Code blocks allow you to run multi-line formulas, enabling variable definitions, conditional logic, and more. This not only adds power but also simplifies handling complex scenarios compared to single-line formulas.

Let's look at an example of how we can use {button} and {run} with Code blocks:

{run: tasks = ["Take out the garbage", "Wash the car"]}
; label=❌}{endrepeat}

return
endif

Note: {button}, {run} and Code blocks are currently in Beta and may change in the future.

## Limit Link Row Fields to Specific Views

Now, when setting up a link row field, you can restrict the field to only allow selections from a specific view in the target table.

## Performance improvements

We have made a number of performance improvements to Data Blaze over the past month. Specifically:

• Snapshotting and creating a space from a template will be much faster
• Some date-time formula functions are much faster
• Formulas that do not depend on other fields will be much faster in many cases
• General speed ups across all processor-intensive operations

# Video of the Month

Learn how to add interactive buttons & multi-line formulas to your snippets in this video:

# And remember...

We're always here for you! If you ever need a helping hand, don't hesitate to drop a line in our Question and Answer community forums. And if there's something you'd love to see in Text Blaze or Data Blaze, we'd be absolutely thrilled to hear about it in the Features Ideas section.

5 Likes

I love this update and all these enhancements! Especially the button. I got to thinking though. A button that adds is great, but what if a user needs to subtract from their selection? Here's what I came up with.

Click count: {formtext: name=count; default=0}
{button: count = count + 1; label=+} {button: count = count - 1
; label=-}

1 Like

Works great!

1 Like

I wonder - could there be a way that after clicking the Add Task button, focus is returned to the task form field so the user can quickly add another task? As it stands, one must either shift tab or click back on the field to do so. Would be great if this was a default behavior. It's not a huge deal on its own, but the positive impacts are tremendous when considering the compound affects of many users running the snippet countess times.

1 Like

Interesting idea Brad. I wonder if there should be something like a `focus` function that allows you to focus a field.

Maybe you could pass it the name of a form variable and it focuses that first form field in the page that has that name.

For example, this would focus the form field that has `name=task`:

``````focus("task")
``````

You could then include it in your button code to set the focus how you would like.

1 Like

YES! Bingo!

1 Like

Here's a Reset button to bring the field back:

Click count: {formtext: name=count; default=0}
{button: count = count + 1; label=+} {button: count = count - 1
; label=-} {button: count = 0; label=Reset}

2 Likes

Great! We'll get a `focus()` function added.

3 Likes

Trying to wrap my head around the new {run} command and how/why/when to use it. Based on the documentation, it seems to set the value of a field. How is that different than giving a field a "default" value? I feel like I want to somehow interact with the {run} command but I am missing something.

Yes, setting a value is similar to having a field with a default, however:

1. {run} doesn't require creating a field
2. {riun} can be put in a {formtoggle} or {if} so that the value is changed at some point other than snippet launch
3. Most importantly, you can do a lot more than set a value in {run} (for instance, you could add a row to a space)
1 Like

@scott's list is great. To give a concrete example related to form `default`, using a {run} command, you set dynamic default values for form fields. For example:

Here, the default form field value gets set to the first entry from the table ("John"). It's not possible to do this without {run} command.

@Gaurang_Tandon That's where my disconnect is happening. Seems on the surface like its getting the name from the table then passing that name to the formtext field. Why not just get the value from the dbselect like we have been doing? What am I missing? Thank you for humoring me!

The use case I demonstrated was to be able to change a value after fetching it from dbselect. If you do not want to change the value and use it as is, then the regular dbselect is probably sufficient. This was requested in our community elsewhere (Formdate with a default date taken from another variable)

Ah ha! Thank you for that further explanation. I get it now.

2 Likes