Skip to content Skip to main navigation Skip to footer

Conditional coding & logic to generate different versions of the same template

Example Use Case for conditional coding:
Conditional Coding:  We will have some templates that will have different versions of.  For example, we have a template that contains 2 versions, a “lease” version and a “loan” version.  The idea would be to merge this document into one template but use conditional coding and logic to populate the appropriate details (ex. On the mentioned template there may be a field that should say “Loan Agreement” if the product is a loan but would then say “Lease Agreement” if the product is a lease).  In my past experience I have used “If / Then” coding to do this.  Does A5 Documents allow for this?  

App Expert Reply:
Yes you can create a conditional merge section on a template.  You can create a formula field that is a checkbox that can check the box on one condition or leave unchecked if another condition.  Then in the template builder you select this field and indicate to use it as a conditional merge section and you put this merge code in the beginning of the section and end of the section.

Another option around this type of concept is to create a formula that can provide lets say the title of the agreement and in the formula field you would have what ever logic you need to display “Loan Agreement” or “Lease Agreement”.  This could be good strategy if only a few things that are different.  Otherwise using conditional merge sections can make more sense when more differences.  Another option is having two templates.  And your button code you click to merge the document can have an if statement in the button code to decide which Document Action to use for the document based on some field value.