Logic Blocks make up the invisible "back end" of your app. They create variables whose values are logical expressions, blocks of text, conditional statements, or lists.
It's possible to build a relatively simple app with zero Logic Blocks, but you'll likely need Logic Blocks for more advanced apps.
To add a Logic Block, click "Add logic" under the Blocks tab of the App Builder:
Expression Blocks create a variable that is True if the associated logical expression evaluates to True:
Text Blocks create variables that are equal to a block of text (known as 'text variables'). For example, this text variable creates a block of text that represents a clause that may or may not be inserted in a document template:
Encapsulating text in variables allows you to conditionally add that text to document templates, because when you add a variable to a template you can specify that it should only be added under certain conditions.
Conditional Blocks allow you to create a variable that has the value of one of a pre-determined set of variables or pieces of text (i.e. strings).
For example, imagine you want to create a template invoice where the price changes depending on what service the end-user selected:
This price, encapsulated in the variable price_for_document, can have one of three possible values as determined by your Conditional:
What is happening in the above Conditional:
Note: In this example, there are only 3 possible services the end-user can request. This means, after we define the price to use for two services, we can simply instruct the conditional to "fall back" on price_3 if neither of these two services is requested.