Remember when you had your contract templates in Word with “gaps” to fill in and you would copy and paste the information where it belonged? With Parallel, you no longer need to copy and paste the information, you can leave that job to the references.

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

However, sometimes it is not enough just to paste an answer, but we want a text or paragraphs to appear according to the answers.

In this article, we will explain how to add conditions with references.

Note: This option complements field conditionals and allows you to create content with more flexibility and in a powerful way.

There is no right or wrong way, but in some cases it will be more agile to use conditional logic in dynamic texts and, in others, field conditionals.

When to use conditions with references

Let's see it with a simple example. Let's imagine that we have a coffee shop and we want to treat our customers to something every time they order a coffee. When they order coffee we will ask them what they like, sweet or salty (this is the external variable).

If our customer answers they like sweets, we will want to give them a pastry. On the other hand, if our customer tells us that he likes salty things, we will give him a small sandwich.

This type of decisions can be automated within Parallel by applying conditional logic to dynamic texts. In this way, if they answer that they like sweets, we will give them a cake, and if they answer something else, we will give them a sandwich.

How to apply conditions in dynamic texts

Before applying conditions, it is important to have created the references of each field to add them. If you do not know how, we explain it in the following article.

Once you have your references created, if you go to the Content table of the petition you will see that the fields with references have two buttons:

  • One to copy the simple reference

  • And another of More options, where you will find the formulas of that field.

When you select “More options”, you will see that each field has different formulas depending on the type of field (Short answers, Options, Numbers, etc.). But they all have one in common “Conditional text”.

Conditional text formula is the one that allows to display one text or another depending on the answer chosen.

Generally, it is used with Options or Dropdown fields that offer a list of options, although it can also be applied to text responses.

Let's see an example with a Multiple Choice Field:

When you answer what type of food you like best, sweet or savory, I want the text below to recommend a dish of the type of food you like best.

To do this, I will go to the food field, copy the formula “Conditional text” and paste it into the description of the recommendation block.

A text like this will be pasted:

{% if food contains "Sweet” %} 
This sentence will be displayed when “Sweet” is selected.

{% elsif food contains "Savory” %}
This sentence will be displayed when “Savory” is selected.

{% else %}
This sentence will be displayed if none of the previous options is selected.

{% endif %}

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

When I have nothing selected I get this sentence:

And if I select one option I get this other one:

But, this is not the food recommendation I wanted to make. Let's see how to change these phrases!

How to customize the displayed sentences

Let's go back to the EDIT view, specifically to the field where we paste the formula to edit the phrases.

{% if food contains "Sweet” %} 
This sentence will be displayed when “Sweet” is selected.

{% elsif food contains "Savory” %}
This sentence will be displayed when “Savory” is selected.

{% else %}
This sentence will be displayed if none of the previous options is selected.

{% endif %}

The first sentence will be displayed if “Sweet” is selected, the second sentence will be displayed if “Savory” is selected and the last sentence will be displayed when no option is selected.

All we have to do is change these phrases to the content we want to appear:

{% if food contains "Sweet" %} 
Don't miss the chocolate cake!

{% elsif food contains "Salado" %}
You will love our chicken sandwiches!

{% else %}
Select your favorite type of food so we can give you our recommendation.

{% endif %}

If you do not want anything to appear when there is no option selected just delete the text that appears after {% else %}

And that's it! Now, if we go to PREVIEW we will see that the phrases we have indicated appear:

Apply conditions with text responses

As we saw at the beginning, conditions can be applied to all types of fields. We have already seen how they work when dealing with fields with options, now let's see how they work in the rest of the fields.

Let's look an example:

I have a clinic open Monday through Saturday and I want to let me know when someone wants to schedule an appointment on a Sunday.

We follow the same steps as above, but this time starting from a "Short Answer" question, when pasting the "Conditional Text" formula I will see this:

{% if day == "Example reply" %} 
This sentence will be displayed when the reply is "Example reply".

{% endif %}

It is a formula similar to the previous one but with a small difference, where it says:

{% if day == "Example reply" %} 

In "Example reply" we have to replace it with the word that will make the message jump. In this case "Sunday", and then the sentence that has to be sent.

{% if day == "Sunday" %} 
Sorry, we are closed on Sundays. Please choose a day from Monday to Saturday so we can serve you.

{% endif %}

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

Now when I answer with the word I have chosen, the sentence is displayed.

Now that you have learned how to generate dynamic texts, we encourage you to continue learning and enhance your processes with the following guides:

  • Formulas for questions with conditions (Advanced): Learn more about conditions with advanced features.

  • Basic formulas with text responses: Choose if you want your references to be copied and pasted with uppercase, lowercase, etc...

  • Formulas for questions with multiple answers: If for a question there is more than one answer, automatically configure how these answers will be displayed (together, separated, listed...).

  • Formulas for numerical fields: You can copy and paste numbers in different formats and choose formulas to make calculations with them.

Did this answer your question?