Help Desk

Submit a ticket My Tickets
Welcome
Login

Handlebars Use Case: Set varying date formats

Handlebars are a powerful way to create dynamic variables for use in other Chain Commands.  A simple example is setting a target application date.  One system may split the date into two unique segments - Month (MMMM) and Year (FYYY) while another may combine into a single string (MMM-YYYY).  Rather than maintain three unique variables, Handlebars provide a way to create the varying formats required as an Output that can be used as an Input in a subsequent Command.  

In this example, we are utilizing the Handlebars BizApp -> Render Text Template Command to create three variables based on the System Date and Time that the Chain is run.  The Output of these Commands will be used to drive various subsequent processes such as running a calculation to clear data and running a data load process.

Step 1: Create Handlebar Command

The variable output that will be used in later Commands is specified in the Template.  In this example, it combines values from the Variables section called Month and Year.  Each Variable is wrapped in double curly braces ({{ }}).  The value associated with the Month and year variables are derived from the system date and time.

Use date variable transformation to set the needed formats.

Additional Handlebar Commands are added to create the Month Name and Fiscal Year variables.

Step 2: Utilize the Variables 

Assign the Handlebars output to a Command parameter.

Step 3: Review Results

While this example illustrates how Handlebars can be used to create variables based on the system date and time, they can also be extended to extract values from a JSON array. This forum post provides more information about JSON arrays and Iteration.  

Handlebars are an extremely powerful way to enhance an integration and ensure that variables are dynamic and reusable across the Chain.  If you need additional help with Handlebars, please feel free to post a response or contact us at support@onecloud.io.

  • Awesome explanation.  Thanks OneCloud and Tony!


    1 person likes this
  • Thank you Wayne!

  • Was wondering about the use case of Handlebars. Now we know. Great post Tony!!

  • Glad you found it useful Ramesh!  Handlebars open up a world of possibility.  I've used them at a number of customers now to help templatize various outputs.  If you have any specific questions once you delve in, please don't hesitate to open a thread.


    1 person likes this
Login to post a comment