Dynamic texts: Numbers

Learn how to format numbers when generating dynamic texts.

Derek avatar
Written by Derek
Updated over a week ago

As you may already know, in Parallel we have number fields, that is, questions that only accept numerical answers.

As we explained with the fields with text replies, fields with numeric answers can also be used in references.

💡 What are references? If you want to know more, see the following link.

In the same way as with text response fields, you can include a reference and copy it from the table of Contents and paste it in another field.

But don't stop here! You can also copy the reference using different formulas that will allow you to make automatic calculations with the answers to your numeric fields. In this article we show you what options you have.

Formulas with numerical answers

As you may have already know if you have used references, when you copy and paste a number reference from one field to another field in the template, the reference is not only enclosed in " {{ }} ", but also adds a " | number ". Thus:

{{ reference | number }}

In addition, if you want to do calculations or format the number, instead of using the simple Copy to clipboard table of contents button, select the three-dot menu and you will get these formulas:

  • Quantities

  • Percentage

  • Round up

Where can I find these formulas?

When we have included a reference in a field of type number, we will see that, in the table of contents of the template, two buttons appear next to that field:

  • One to copy the simple reference

  • And another one for Other options, where we will find the formulas of that field.

💡 If you don't see these buttons or want to know more about simple references we recommend you to read this article first.

Let's take a look at them with examples one by one!

Quantity

This formula achieves the same as the simple Copy to clipboard, which is the button next to the three dots menu.

When you choose this formula, the number will be displayed with thousands and decimal separators according to the language of the template.

To use this format, add the character "|" followed by the reference and the filter "number".

{{ reference | number }}

For example, I want the amount invested in one field to be copied and pasted to another field as a summary.

To do this, I will go to the "How much will you invest in de company?" field, copy the formula "Quantities" and paste it into the description of another field.

This formula will be pasted:

{{ investment | number }}

Now let's go to the Preview tab to see what it looks like!

Percentage

If the number you are adding is a percentage, you can format it with the "percent" formula:

{{ reference | percent : 2 }}

For example, I want the percentage of shares of a company that I indicate in one field to be copied and pasted into another field as a summary.

To do this, I will go to the field "Indicate the percentage of shares you hold in the company?", copy the formula "Percentage" and paste it into the description of another field.


This formula will be pasted:

{{ investment | percent : 2 }}

Now let's go to the Preview tab to see what it looks like!

💡 Note: You will see that the percentage is copied with two decimals. You can choose the number of decimals places you want to appear by changing the number 2 in the formula.

For example, if you do not want your percentage to be copied with decimals, you would change the 2 to a 0, like this:

{{ investment | percent : 0 }}

It will look like this:

Round

With this formula, the answer your client adds will be copied and pasted into another field rounded to the nearest whole number.

This formula adds the character "|" and the word "round":

{{ reference | round }}

This formula will be pasted:

{{ kilos | round }}

Now let's go to the Preview tab to see what it looks like!


Did this answer your question?