•Extracting a Substring of an Element
The following sections illustrate example dynamic values:
Describes how to use the {new_line} value to insert a line break.
Describes how to use the dynamic value operators + and - to add or subtract integer, fixed or currency type elements.
Describes how to check the value of a data element before inserting a dynamic value (you could use this to check for no value).
•Extracting a Substring of an Element
If you are joining multiple values using a dynamic value, you can use the {new_line} value to insert a line break.
Information Not leaving space between the street address and the next address element can result in overlapping lines. For example, printing a customer’s address on a ticket using an element requires leaving multiple lines of space between the street element and the next line in the address. This is to accommodate multiple street address lines. However, if the customer does not have a street address with multiple lines, this method of inserting the address will leave a large gap between the street address and the next line of the address. |
In the example printed ticket below, the address is inserted using an element illustrating the potential gap between address lines:
To prevent this gap and to handle multi-line addresses, you can instead use a dynamic value to insert the address and {new_line} to insert line breaks:
{Address::street}{new_line}{Address::city}{new_line}{Address::state}{new_line}{Address::country}{new_line}{Address::zip}
Information If the {new_line} value was not used in the dynamic attribute, the address would appear on one line. |
Consider the same address above, printed using the dynamic value:
The dynamic value operators + and - can be used to add or subtract integer, fixed or currency type elements:
{element + element}
{element - element}
Where the element is an integer, fixed or currency value.
Information Attempting to use the + and - operators with other data types will result in an error. |
For example, to display the net value of charges, including included taxes, use the following dynamic values:
•{Admissions::charge_net + Admissions::charge_incl_tax}
•{Totals::Admissions::charge_net + Totals::Admissions::charge_incl_tax}
•{Totals::Bundles::charge_net + Totals::Bundles::charge_incl_tax}
There may be instances when you only want to insert an element if it has a value. You can create a conditional element to achieve this.
For example, you want to insert the contact’s title, first and last name on the ticket. Because there may not be a contact title, you can create a condition so that the contact’s title is only included if there is a value. If you do not create this condition, the application may insert a blank space on your ticket.
Use the following table to create this example dynamic value:
Type |
Field |
Value |
Default Pattern |
Default Pattern |
{Contact::title} {Contact::first_name} {Contact::last_name} |
Rule |
Position |
1 |
Rule |
Pattern |
{Contact::first_name}{Contact::last_name} |
Conditions |
Parameter |
Contact Title |
Conditions |
Operator |
is empty |
Conditions |
Value |
enter any value This value acts as a place holder. You can enter any value. |
You can extract a substring of an element by specifying starting location and optionally the length of the string to extract:
{element::[start [,length]]}
Where:
•element is the element from which the substring is extracted.
•start is the starting position of the substring. The first alphanumeric character in the string is zero.
•length is the number of alphanumeric characters to include in the returned substring.
For example, the following inserts a J and then the first six characters of the marketing data string, the letter K, then the next six characters of the element, and then the letter L at the end:
•J{Marketing::data1::0,6}K{Marketing::data1::7,6}L
For this full example, refer to Bar Code Formatting for Windows Devices.