Here's an example of a Variable that concatenates fields, uses a formula to select the appropriate fields, and uses Operators and Functions within the formula. It is adapted from the Name Variable in the standard Customer Address List report.
@IF([CST:Name]~,
[CST:FirstName] [CST:LastName],
@LEFT([CST:Name],30)(,)[CST:FirstName] [CST:LastName])
Broken down into its parts:
@- Means that whatever follows is going to be a Function.
IF- The name of the IF Function @IF(Expression,TruePart,FalsePart)
(- This is where the Function starts.
Expression- The first part: [CST:Name]~
TruePart- The second part: [CST:FirstName] [CST:LastName]
FalsePart- The third part: @LEFT([CST:Name],30) (,) [CST:FirstName] [CST:LastName]
@- The beginning of another Function!
LEFT- The name of the LEFT Characters Function: @LEFT(Text,NumCharacters)
(- This is where the Function starts.
Text- The first part: [CST:Name]
NumCharacters- The second part: 30
)- This is where the LEFT Function ends.
(,)- Whatever is inside these parentheses will form a separate group.
[CST:FirstName]- The Customer First Name
[CST:LastName]- The Customer Last Name
)- The end of the IF Function, and the Variable itself.
See:
Variables Example - Concatenate Customer First Name and Last Name - Detailed, Printable Version
Edit Variable Screen
Variables in SubTotals and Grand Totals
Filters and Formula Functions
Filters and Formula Operators
Filters - Transaction Types
Report/Label Editor Contents