Conditional IF Logic via PDF ConfigFiles

Doc Auto Team
Doc Auto Team
  • Updated

Overview

Athennian now fully supports advanced IF statements through PDF ConfigFiles. You can write conditional fallback logic directly in a PDF ConfigFile to dynamically assign variable values — and have those assignments apply automatically across all connected templates.

What Is a PDF ConfigFile?

A PDF ConfigFile (also called a subTemplate) is a centralized file that acts as the logic brain for your document automation. It stores all variable assignments and conditional logic in one place, feeding values to hundreds of connected PDF templates simultaneously.

Key benefits:

  • A single ConfigFile can power hundreds or thousands of templates.
  • One logic update propagates instantly to every connected template — no need to edit individual PDFs.
  • Cleaner templates — complex logic lives in the ConfigFile, not scattered across individual PDF forms.

Previous Limitation

PDF ConfigFiles previously had a gap in their conditional logic support: if the first {#if} block evaluated to FALSE, the engine would not evaluate the second block — returning a blank value instead of falling back to the next condition.

For example, this pattern would fail if the first condition was FALSE:

{#(tasks | grab:1:'taskType')=='changeOfCompanyName'}
newNameASG=={tasks | grab:1:'newName'}
{/}
{#(tasks | grab:1:'taskType')!='changeOfCompanyName'}
newNameASG=={entities | grab:1:'entityName'}
{/}

The engine would evaluate the first block as FALSE — and then stop, returning blank instead of running the second block.

What Changed

The DXT engine now correctly evaluates all conditional blocks in sequence. If the first {#if} block is FALSE, the engine continues evaluating subsequent blocks until it finds one that is TRUE and executes its assignment.

The same pattern above now works correctly:

{#(tasks | grab:1:'taskType')=='changeOfCompanyName'}
newNameASG=={tasks | grab:1:'newName'}
{/}
{#(tasks | grab:1:'taskType')!='changeOfCompanyName'}
newNameASG=={entities | grab:1:'entityName'}
{/}

If the task is a company name change, newNameASG is set to the new name. Otherwise, it correctly falls back to the entity name.

How to Write IF Logic in a PDF ConfigFile

Syntax Structure

{#(condition)}
variableName=={value}
{/}
{#(else condition)}
variableName=={fallback value}
{/}

Syntax Rules

  • Open a conditional block with {#condition}
  • Assign a value inside the block using variable=={value} — note the double == which is specific to PDF ConfigFile syntax
  • Close every block with {/}
  • Chain as many conditional blocks as needed for full fallback coverage

Full Working Example

Assign a variable based on task type, with a fallback if the condition is not met:

{#(tasks | grab:1:'taskType')=='changeOfCompanyName'}
newNameASG=={tasks | grab:1:'newName'}
{/}
{#(tasks | grab:1:'taskType')!='changeOfCompanyName'}
newNameASG=={entities | grab:1:'entityName'}
{/}

Tips & Best Practices

💡  Always test both the TRUE and FALSE branches of your conditions before connecting the ConfigFile to live templates.

💡  The double == assignment syntax (variable=={value}) is specific to PDF ConfigFiles — make sure not to wrap the left-hand side in curly braces.

💡  A single ConfigFile update propagates to all connected templates instantly — no need to edit individual PDFs.

💡  Use descriptive variable names (e.g., newNameASG) so your logic is easy to maintain and hand off to other coders.