/ Search

Search Epistola

Find documentation, integration guides, tour steps, blog posts and pages.

DocsIntegrationsTourBlogPage
↑↓↵esc

Show or hide a paragraph

Use a Conditional block for information that is sometimes missing, or for wording that depends on a decision.

Before you begin

You need Content Author access, and a template you can change. On the Data contract tab, choose Edit and add the optional field explanation (Text). Also add two examples: one with text and one without the field. Choose Save, then Done editing.

Show an optional explanation

  1. Open the variant editor and select the example containing an explanation.
  2. Add a Conditional block from Blocks. A new Conditional has a body slot and an else slot.
  3. Select the block. Under Properties, choose the Condition field to open the expression dialog. In Code mode enter:
$exists(explanation) and explanation != ""
  1. Save the expression and leave Inverse off.
  2. Place a Text block in the body slot of the Conditional. Write Explanation: and insert the explanation field through {{.
  3. Preview both examples. The whole paragraph should disappear when the field is absent or an empty string.

If you hide just the expression chip, labels and punctuation stay behind. So put all wording that belongs to the condition inside its body.

Show other wording when the condition is false

The else slot renders when the condition is false. Use it when both cases need their own wording, instead of two Conditionals with opposite conditions. A Conditional made before Epistola 2.0 has no else slot. Select it and choose Add else branch in the inspector.

Choose wording from a decision

Take a required Boolean field named approved. Use the condition approved = true. Put the approval paragraph in the body slot and the refusal paragraph in the else slot. Let the source system make the decision. The template only shows the result it receives.

Add examples for both values. Check that each PDF shows exactly the right paragraph. A missing value is different from false. If every document needs an outcome, make the decision field required.

If the paragraph is unexpected

Check the selected example, the field path, and the Inverse setting. Inverse swaps the body and the else branch. Use Boolean true/false, not the strings "true"/"false". The condition must give true or false the way you intend. That a field exists does not mean its content is useful.

To find the cause, see Data and expression problems. Use Review a template before you publish.

More on this topic

Epistola is open source, not free of cost. The organisations that use it fund its development, through Epistola or an Official Partner. We are steward-owned: fair prices, no profit maximisation. How Epistola is funded →