Create a Business Rule in XML
Before you begin creating a business rule for use with Loftware Enterprise™ SP, you should identify the decision points, constraints, and sources of data that impact labels and printing. If you identify a need for business logic beyond what can easily be incorporated into data sources in a label template, then you may need a business rule. You can use the information that you have collected about your organization's procedures for printing labels to write business rules to support those procedures.
You can create a simple business rule by using the Configurator In Application Design, the graphical interface for configuring a business rule by creating component sets, each containing component blocks that are run when a particular trigger event occurs., or you can perform preliminary development of a business rule in Configurator and then switch to the XML Editor if necessary. The XML Editor allows you to program the business rule in extensible markup language (XML). However, you must complete any development for which you intend to use Configurator before you begin editing the business rule in the XML Editor. For more information, see Create a Business Rule in Configurator.
Tip: If you are writing a business rule or a portion of a business rule in XML, it is recommended that you write it in a text editor intended for use with XML, and then copy and paste the business rule into Loftware Enterprise SP. For information about business rule components and the syntax of business rules, see Business Rule Reference.
To add a business rule to Loftware Enterprise SP, do the following.
- If you want to perform preliminary development by using the Configurator, you must do so before you begin to edit the business rule in XML. To perform preliminary development by using the Configurator, see Create a Business Rule in Configurator.
- If you do not want to perform preliminary development by using the Configurator, click Application Design
- Click
> Business Rule to create a new business rule.
- In the Properties pane, enter a Description of the business rule, including its purpose.
- Click
- When you are ready to program the business rule by using XML, click the View tab, and then click XML.
- Click Enable XML Editor, and then click OK to activate the XML Editor.
Important! After you enable the XML Editor, you can edit the business rule in XML. However, you can no longer edit it by using the Configurator. This change cannot be undone.
- If you performed preliminary development by using the Configurator, but also used a text editor to program XML to add to the business rule, do the following.
- In the text editor in which you created XML to add to the business rule, copy the XML.
- In the XML Editor in Loftware Enterprise SP, position the insertion point where you want to add the XML that you copied from the text editor.
- Right click, and select Paste.
- If you did not use the Configurator, but did use a text editor to program XML to add to the business rule, do the following.
- In the text editor in which you created XML for the business rule, copy the XML.
- In the XML Editor in Loftware Enterprise SP, select the text of the placeholder business rule that you are going to replace.
- Right click, and select Paste.
- If you did not use either the Configurator or a text editor, in the XML Editor in Loftware Enterprise SP program the business rule by using XML. For information about business rule components and the syntax of business rules, see Business Rule Reference.
- To neaten the indentation and spacing of the business rule, click Format XML.
- To check whether the XML is properly formatted, click Validate Business Rule.
- Click File > Save or click the Save
button in the toolbar.
- If the business rule has not previously been saved, in the left pane of the Save dialog box, click the folder in which you want to save the business rule. You can click a folder to display subfolders.
- Enter a name for the business rule in the Name box.
Characters permitted in names
The following characters are permitted in the name: letters, numbers, parentheses, square brackets, ampersands, plus signs, commas, semi-colons, and tildes. Additionally, the following characters are permitted but cannot begin or end the name: spaces, double quotation marks, single quotation marks, hyphens, underscores, periods, and grave accents. For letters, the case that you specify is displayed, but case is ignored when Loftware Enterprise SP interprets a name. If you will be installing the Loftware Enterprise SP application on a computer running Windows Server, and transferring data between Loftware Enterprise SP instances, see the "Transferring Data in a Compressed File" section of the Loftware Enterprise SP Data Transfer Guide.
- Click OK to save the business rule. If you have omitted any items for which default values exist, they are automatically added to the business rule when you save it.
Tip: Because default values may be added to a business rule when you save it in Loftware Enterprise SP, after saving the business rule it is recommended that you copy and paste it back into the text editor that you used to create it so that you have the most recent version available in the editor if you need to make changes.
- Enter a name for the business rule in the Name box.
Note: The first time you save a business rule to a version-controlled folder, the business rule is automatically checked out. When you are finished editing it, be sure to click File > Version Control > Check In to save and check in your version, and make it available for others to check out.
Next Steps
Create a process to run the business rule and receive data from it. For more information, see Create a Simple Process, Create a Generator Process, or Create a Reprint Process.