Single-Line Expression

The Single-Line Expression is the simplest of the three script types supported by BarTender. A single-line expression can perform basic tasks, such as removing a set portion of a data source file string, or searching for and removing certain characters. Single-line expressions typically make use of some combination of "functions" and "operators." Operators most commonly (but not necessarily) perform mathematical functions on numeric data. Functions can also operate on mathematical data, but are more commonly used to manipulate a set of characters (or a "string").

Sample Functions

All of the sample functions shown here are "string" functions, the most commonly used functions in BarTender. However, a variety of other function types are also listed in the Script Assistant. (The angle brackets and variable names shown within the parentheses are to show the "syntax" of the functions — they are not part of the functions themselves. You will fill in the contents of the parentheses with the appropriate field names, variables, and/or constants and will not type the angle brackets.)

Function

Description

Field("PartNumber")

Returns the data contained in the hypothetical database field "PartNumber".

Left(<<String>>,<<Length>>)

Returns the number of leftmost characters in String specified by Length.

RTrim(<<String>>)

Removes any trailing spaces from the right side of String.

FormatCurrency(<<Expression>>)

Takes the Expression or number and formats it like a price.

UCase(<<String>>)

Takes the characters in String and forces it to upper case.

Sample Operators

Sample Single-Line Expressions

All functions, including the Sample Functions shown above, are already single line expressions. In addition, you can combine functions using operators and even put a function within a function. (Some of the examples below assume use of a database containing fields called "PartNumber" and "Color".)

For a more detailed explanation of these and all functions available in Visual Basic Script, please see the Description option or press the Visual Basic Help button in the Script Assistant. For information on using BarTender objects in Visual Basic Script, click here.

Related Topics