Conditions
Time to learn: 10 minutes
Prerequisites: Understanding of Placeholders
Conditions are "if-then" rules that control when placeholders and sections appear in your documents. They let you show or hide content based on your data.
Conditions Quick Reference
What Are Conditions?​
Conditions let you create rules like:
- "If customer is VIP, show special discount message"
- "If status is approved, show approval notice"
- "If amount is over $1000, show premium features"
Think of them like IF statements in spreadsheets - if a condition is true, show the content; if false, hide it.
Decision Tree: When to Use Conditions​
Why Use Conditions?​
Conditions let you:
- Personalize content based on data values
- Create dynamic documents that adapt to each record
- Reduce template complexity by using one template for multiple scenarios
- Show relevant information only when it applies
How Conditions Work​
When Gdocify generates a document:
- It evaluates the condition using data from your record
- If the condition is true, the content is shown
- If the condition is false, the content is hidden (or deleted)
Setting Up Conditions​
For Placeholders​
- Open the Mapping Config overlay
- Find the placeholder you want to conditionally show
- Expand Advanced Settings
- Enable Conditions
- Build your rule using the query builder
- Choose the action: Show or Hide
For Sections​
- Open the Mapping Config overlay
- Go to the Sections tab
- Find or create your section
- Set the action: Show or Hide
- Build your condition rule
Visual Query Builder​
Gdocify provides an easy-to-use visual query builder - no coding required!
Building a Condition​
- Select a field from your data source
- Choose an operator (equals, contains, greater than, etc.)
- Enter a value to compare against
- Add more conditions with AND/OR if needed
Available Operators​
- Equals (
=) - Exact match - Not equals (
!=) - Not an exact match - Contains - Field contains the value
- Doesn't contain - Field doesn't contain the value
- Begins with - Field starts with the value
- Ends with - Field ends with the value
- Greater than (
>) - Numeric comparison - Less than (
<) - Numeric comparison - Greater than or equal (
>=) - Numeric comparison - Less than or equal (
<=) - Numeric comparison - Is empty - Field has no value
- Is not empty - Field has a value
- In - Field value is in a list
- Between - Field value is between two values
Combining Conditions​
You can create complex rules by combining conditions:
AND Logic​
All conditions must be true:
- "Status is 'Active' AND Amount is greater than 1000"
OR Logic​
Any condition can be true:
- "Status is 'VIP' OR Status is 'Premium'"
Mixed Logic​
Combine AND and OR:
- "(Status is 'Active' OR Status is 'Pending') AND Amount > 100"
Use Cases​
Show Premium Features​
Only show premium features for premium customers:
- Condition:
customerTypeequals "Premium" - Action: Show placeholder
{{premiumFeatures}}
Conditional Messages​
Show different messages based on status:
- Condition:
statusequals "Approved" - Action: Show placeholder
{{approvalMessage}} - Condition:
statusequals "Pending" - Action: Show placeholder
{{pendingMessage}}
Hide Irrelevant Sections​
Hide sections that don't apply:
- Condition:
hasDiscountequals "Yes" - Action: Show section "Discount Details"
- Condition:
hasDiscountequals "No" - Action: Hide section "Discount Details"
Delete Paragraph Option​
When hiding a placeholder, you can choose to:
- Hide placeholder only: The placeholder disappears, but the paragraph remains
- Delete entire paragraph: Remove the whole paragraph containing the placeholder
Use "Delete paragraph" when:
- The paragraph only contains the conditional content
- You want a cleaner document when content is hidden
- The paragraph doesn't make sense without the placeholder
Practical Examples​
Example 1: VIP Customer Discount​
Condition:
- Field:
customerType - Operator: Equals
- Value: "VIP"
Action: Show placeholder {{vipDiscount}}
Result: Only VIP customers see the discount message.
Example 2: Approval Status​
Condition:
- Field:
status - Operator: Equals
- Value: "Approved"
Action: Show placeholder {{approvalStamp}}
Result: Approved records show an approval stamp.
Example 3: High-Value Orders​
Condition:
- Field:
orderAmount - Operator: Greater than
- Value: 1000
Action: Show section "Premium Service Details"
Result: Only orders over $1000 show premium service information.
Best Practices​
- Test conditions carefully: Make sure conditions work as expected
- Use clear field names: Makes building conditions easier
- Document your conditions: Note why each condition exists
- Start simple: Begin with basic conditions, add complexity gradually
- Test edge cases: What happens with empty values? Null values?
Common Mistakes​
- Wrong operator: Using "equals" when you need "contains"
- Case sensitivity: "VIP" is different from "vip"
- Empty values: Conditions with empty fields may not work as expected
- Complex logic: Over-complicating conditions when simple ones work
Tips​
- Use the query builder: It's visual and easy to use
- Test with sample data: Verify conditions work before generating many documents
- Combine with sections: Use conditions on sections for more control
- Keep it simple: Simple conditions are easier to maintain
Next Steps​
Now that you understand conditions:
- Learn about Sections for conditional content blocks
- Explore Placeholders for basic data insertion
- Check out Use Case Examples for real-world scenarios