Application DesignBusiness Rule Components

You can use a business rule component to add or change data in the data map, to incorporate conditional or loop logic, or to implement branching. Additionally, you can use JavaScript within some types of business rule components to change data in the data map. The following tables summarize the purpose of each type of business rule component that you can use in a business rule in Loftware Enterprise™ SP.

Note: You can nest business rule components to perform complex operations.

Best Practice

Use priority values to control the execution order of business rule components. Additionally, within a business rule it is recommended that you list peer business rule components in execution order so that the business rule will be easier for others to understand.

Adding and Changing Data

Component Type Purpose Syntax

Data Map Operations

Add, remove, or change data map entries.

mapOperations

Data Service

Add rows of data from an external database to the data map.

Comparable to a Database data source, a File data source, or an HTTP data source.

dataService

Date/Time

Calculate and return the date and time of processing, adding it to the data map.

Comparable to a Date/Time data source.

dateTime

Export Data

Convert data in a structure of data map entries in Loftware Enterprise SP to an equivalent string of text or binary data. This data can be used in other applications that accept data in CSV or XML format.

exportData

Import Data

Convert a string of data from CSV or XML format to an equivalent structure of data map entries for use in Loftware Enterprise SP.

importData

Increment/Decrement

Return the value of a counter that is increased or decreased for each printed label in a print job, adding the value of the counter to the data map.

Comparable to an Inc/Dec data source.

incDec

Static

Add default data or other parameters to the data map.

static

XML Data

Add data extracted from XML to the data map.

Tip: This type of business rule component can be used in conjunction with a SOAP Web Service data service.

xmlData

Retrieving Status and Information

Component Type Purpose Syntax

Detailed Device Info

Query a device for device information. This is typically information about a device that is not likely to change between print jobs, such as information about the hardware model, firmware version, and amount of installed memory in the device.

detailedDeviceInfo

Detailed Device Status

Query a device for device status information. This is typically information about whether the device is offline and whether error conditions exist that would prevent printing.

detailedDeviceStatus

Security Information

Add the user name, user domain, and user profile information associated with a print request to the data map.

securityInfo

Using Conditional and Loop Logic

Component Type Purpose Syntax

Conditional

Determine whether to perform an action based on the result of a comparison of values or the result of a logical operation.

conditional

For Loop

Repeat an action a specified number of times.

forLoop

While Loop

Repeat an action as long as specified conditions continue to be true and the maximum number of iterations has not been exceeded.

whileLoop

Using JavaScript to Change Data

Component Type Purpose Syntax

Data Map Entry Script

Add read-only data map entries by using JavaScript and return a value.

Comparable to a Formula data source.

mapScript

Data Map Script

Make changes to the data map by using JavaScript.

dataMapScript

Format Script

Make changes to the properties of a label template and to the data map by using JavaScript.

formatScript

Branching

Component Type Purpose Syntax

Data Pipe

For use in business rules for generator processes. From one print request, generate additional print requests. Each print request may use a different label template.

dataPipe

Reference

Load content from another business rule into the current business rule. You can also load data sources from a label template into the data map.

reference

Tip: For assistance with a business rule that you have created or to have Loftware create business rules for you, contact Loftware's Professional Services Group.