Feature: Edit text properties as templates

All text properties can now be edited as templates. Change the text as you normally would in the inspector and insert formula fragments between special markers. This makes it much easier to edit email bodies sent by your app.

Calcapp has many text properties that can be customized using the inspector in Calcapp Creator, including these:

Like other calculated properties, text properties can be set through formulas. In prior releases, this was done by clicking the fx button next to the property in the inspector. By using a formula, information entered into the app by your users and calculated by your app can be made part of the calculated value.

Unfortunately, setting text properties through formulas can be awkward. Let’s say that you want to set the Body property of an email report button using a formula. The goal is to send an email with a body like the following:

Dear Sally,

The weight is 23.30 lbs.

In prior releases, you had to use a formula like the following to achieve this:

"Dear " & Name & "," & NEWLINE() & NEWLINE() & "The weight is " & Weight & " lbs.""Dear " & Name & "," & NEWLINE() & NEWLINE() & "The weight is " & Weight & " lbs."

There are a few problems here:

  • You need to know that & is used to join text strings together.
  • You need to know that you should use the NEWLINE formula function to produce line breaks and paragraphs.
  • Producing a formula like the one above is needlessly complicated, even if you know everything there is to know about formulas.
  • It inhibits the writing process, by making you focus on things other than the text.

You can now use templates instead, directly in the inspector. A template allows you to write text as you normally do, including blank lines, and insert formula fragments between {{ and }} markers.

Autocomplete is active when editing formula fragments, making template editing a first-class formula editing experience.

Here’s the template version of the formula above:

Dear {{Name}},

The weight is {{Weight}} lbs.

You can enter any formula fragments between {{ and }} markers, not just references to fields. These formula fragments can be arbitrarily complex.

This is what using the template looks like in the inspector, with the area where you write the email body marked in red:

Editing the Body property of an email report button

Above, the Body property has been selected in the property selector (also marked in red), causing its formula to be displayed. As you can see, a template is nothing more than an easy way to write a formula.

(Templates don’t use the NEWLINE function. Instead, they insert line breaks in the formula, which is now supported.)

If you prefer editing the text property as a regular formula, you need to select the property from the property selector next to the formula field.

We have removed the fx buttons from text properties in the inspector, and replaced them by buttons. They insert {{ into your formulas and starts autocomplete.

Templates have been enabled for all text properties in the inspector. Some text properties, such as field labels, have never been in the inspector, and still require you to edit the formula like before.

There’s one property that previously was not part of the inspector and now is: text field values:

Editing the Value property of text fields using the inspector

This change makes it possible to edit text field values as templates. If you prefer editing them as formulas instead, simply use the formula field as you normally would.

If you include line breaks in text field values, be sure to toggle Multiple lines in the inspector to its “on” position, so that they are displayed.

« Feature: Access all items as a single array Feature: Autocomplete for formulas »