The Handlebars BizApp is intended to allow OneCloud variables to be dynamically set in any type of text file or text template. This article will explore using the Render File Template and Render Text Template and how they both can work in concert with one another.
In the first example the Render Text Template Command is used to generate a Command Output in the format of "MMM-FYYY". In this particular example, we populate the Template field, with the variables MONTH and YEAR wrapped in double braces. These variables are created by the Handlebars Command and the variables are concatenated with the text "-FY". Also, note that the system date and time is based on when the Command is executed and uses date transformation to be in the particular date format.
In the second example, the Render File Template Command is used. The template file can be loaded as a OneCloud File Resource or stored on any cloud-based file system such as BOX or Google Drive. To support Handlebars, the variables that are to be replaced need to be enclosed in double braces. Below is an example of a Handlebars compliant Microsoft Windows batch file with the Handlebars variables highlighted in yellow.
In the Render File Template Command, the Template field references the aforementioned file resource, "RunJob.cmd". In the Variables section, the three variables and the respective values are set. Variables OC_USERNAME and OC_PASSWORD (highlighted in green) are Workspace variables, and the variable MONTH_FISCALYEAR is the output of the previous Render Text Template Command. The output of the Render File Template Command is a proper batch script where the variables have been replaced.
Finally, execute the rendered batch script with the Run Script Command. Note that the Command field is simply the output of the previous Render File Template Command:
The execution of the batch script generates a log file as follows:
Hopefully it is now clear how to use the Render File Template and Render Text Template as well as how they can be used together. If you have any question, please feel free to contact us at firstname.lastname@example.org.