Template creation syntax for document generation

Hello guys. I am relatively new to Appian.  I have a sample PDF template with the code snippet as shown below:

Approver

«${doc.sample.details.SAMPLE_APPROVER_NAME}»«[#if doc. sample.details.SAMPLE_APPROVER_EMAIL?»«, ${doc. sample.details.SAMPLE_APPROVER_EMAIL}»«[/#if]»

«[#if doc. sample.details.SAMPLE_APPROVED_DATE?h»«${doc. sample.details.SAMPLE_APPROVED_DATE?date»«[/#if]»

where approver is the label and the other two columns are show how values are retrieved from the process.

There are many more labels which haveelements that are looped or which have conditional checks like - 

«[#if doc.SAMPLE.funcs?size gt 0]» «[#assign cnt=0]» «[#list doc.SAMPLE.funcs as f]» «[#assign cnt = cnt + 1]»

The question is - I need to know how this syntax is being written. Is it OOXML ? (I mentioned I was pretty new to this so have no idea the language this is written in, sorry !)How does looping take place in such a language ? 

I have another document for which I will need to retrieve the values from the process and generate a similar template. I have not come across this before and would be great if anyone could help. Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • Hi Sujathar,

    Our team has been looking into document templating recently and we have found that the syntax being used in your example is a common language for document templating known as FreeMarker. In particular, the current version of ADT uses FreeMarker 2.3.20. From the experiments we have done from this language, it looks as though the entire suite is available for use. You can find a reference to the syntax as well as some guides on how to use FreeMarker at the following link:

    freemarker.apache.org/.../ref.html

    They also have guides on the structure of the XML to use, but I recommend using the example they provide in the release of the plugin. You can find this in the zip in the following link:

    forum.appian.com/.../summary

    In regards to looping on variables in a process model, our setup currently uses an XML element representing a single CDT instance with the attributes of it representing the fields. When looping over this list of elements in a form "«[#list doc.project.items as item]» ... «[/#list]»", we don't need to use the counter and instead refer to the fields using "«${item.@field}»". A clearer example of this can be seen on the FreeMarker page on the following link:

    freemarker.apache.org/.../xgui_imperative_learn.html

    Overall, I would refer to the FreeMarker reference for any syntactical or functional questions about the templating language you may have. Otherwise, I would check out the ADT page and the XDocReport GitHub page for any issues that begin to get more technical. If you find the templating fails, make sure to check out the System Logs as that will have the full Java error (which is a saviour I have found). The three pages are listed below:

    www.appian.com/.../
    github.com/.../xdocreport
    https://freemarker.apache.org/

    I hope this helps with your Templating needs!

    Regards,
    Tom
Reply
  • Hi Sujathar,

    Our team has been looking into document templating recently and we have found that the syntax being used in your example is a common language for document templating known as FreeMarker. In particular, the current version of ADT uses FreeMarker 2.3.20. From the experiments we have done from this language, it looks as though the entire suite is available for use. You can find a reference to the syntax as well as some guides on how to use FreeMarker at the following link:

    freemarker.apache.org/.../ref.html

    They also have guides on the structure of the XML to use, but I recommend using the example they provide in the release of the plugin. You can find this in the zip in the following link:

    forum.appian.com/.../summary

    In regards to looping on variables in a process model, our setup currently uses an XML element representing a single CDT instance with the attributes of it representing the fields. When looping over this list of elements in a form "«[#list doc.project.items as item]» ... «[/#list]»", we don't need to use the counter and instead refer to the fields using "«${item.@field}»". A clearer example of this can be seen on the FreeMarker page on the following link:

    freemarker.apache.org/.../xgui_imperative_learn.html

    Overall, I would refer to the FreeMarker reference for any syntactical or functional questions about the templating language you may have. Otherwise, I would check out the ADT page and the XDocReport GitHub page for any issues that begin to get more technical. If you find the templating fails, make sure to check out the System Logs as that will have the full Java error (which is a saviour I have found). The three pages are listed below:

    www.appian.com/.../
    github.com/.../xdocreport
    https://freemarker.apache.org/

    I hope this helps with your Templating needs!

    Regards,
    Tom
Children