◷ Reading Time: 3 minutes
What is a Template?
Logic Document Templates allow you to let FlexRule Designer create logic files from a pre-built one. This ability enables you to create and set up a set of logic (i.e., Decision table, flow, etc.) for your team, and once they want to create new logic, they will use these as a new document rather than the empty vanilla ones.
To add a new Template,
Document Types --> Templates
This enables you to apply a set of practices and configuration on your project, pre-build them into a template and let the team select new logic documents from template sections.
To save any document as a template, open the document and then go to,
Document -> Save As a Document Template
And below Window appears:
- Name: The title or name of the template
- Description: A simple description of the template that helps to understand the purpose of it
- Group: Defines categories to organize the templates. Use \ to define for nested nodes.
- Source: The current document that is opened as the source of the template. Or another document can be chosen as well.
Register a Template
Locate and create an xml file called Templates.xml in the following location
%LOCALAPPDATA%\Pliant Framework\FlexRule Designer
Here is a sample of the XML file:
<Templates> <File name="DT with some extra info" icon="D:\Graphics\all2\48x48\plain\tables.png" category="MyCompany\MyProject\DTs" description="a sample description for your template" path="Templates\PotentialTheftRating.xml" handler="DecisionTable"/> </Templates>
You can add multiple File sections inside the Templates section.
Each file section can include the following information:
- name: the name of the template in the right panel
- icon: image path of the template in the right panel; it can be relative to templates.xml or an absolute path
- category: location of the template in the left tree panel
- description: a hint of what the template is about that will be shown in the description section
- path: address to the path of the template: this can be relative to templates.xml or an absolute path
- handlers: type of the logic document, which can be any of the followings:
Here is the mapping of a file in the new document window:
To register a template, you need to have a logic document that you want to use as a template. To do that:
- Create logic using FlexRule Designer just as a usual logic file
- Register the file using File section
And FlexRule Designer will automatically load the template every time the new document window appears.