Help Desk

Submit a ticket My Tickets
Welcome
Login

What's the difference between the Render File Template and Render Text Template Commands and which should I use?

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 post a response or contact us at support@onecloud.io.Handlebars BizApp

  • This definitely clears some things up for me, but can you please explain to me what the actual problem is which this tool will solve?  


    What would I not be able to do if I don't use handlebars?

  • Pretty sweet!  This is going to open the door to amazing amount of opportunities.  Great work!

    Thanks OneCloud, and Tony for the write up.

  • David,

    Rather than look at it as what you can't do, I would frame the conversation as what can you do with Handlebars.  

    Handlebars is a templating language (https://handlebarsjs.com/guide/).  They allow you to have a templatized script (command line, MAXL, etc) that can be used across different processes with different values but eliminates the need to have different copies of the script with hardcoded values specific to that execution.  If I were to correlate Handlebars to something in the Oracle EPM world (which I believe is where your application expertise lies), I would think of Handlebars similar to how substitution variables in an Essbase calc script work.  The Handlebars variable convention - {{Variable}} - functions in the same way as a sub var in Essbase - &Variable.  

    At the point of execution, OneCloud substitutes the actual value in place of the variable within the template.

    I hope that helps you further understand Handlebars.  Feel free to post additional comments or questions.

    Tony

Login to post a comment