SQL/MP Report Writer Guide
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to the NonStop SQL/MP Report Writer
- 2 Using SQLCI and the Report Writer
- 3 Selecting Data for a Report
- 4 Customizing a Report
- Defining the Layout
- Specifying the Items in a Detail Line
- Naming Select List and Detail Line Items
- Organizing Rows Into Break Groups
- Labeling Information
- Formatting Data Values
- Formatting Dates and Times
- Using TACL to Pass Parameters
- Conditional Printing of Items or Line Entries
- Redefining Special Characters
- Calculating Totals
- Calculating Subtotals
- Printing Double-Byte Characters
- A Comparison of the Report Writer and the Enform Language
- Index

Selecting Data for a Report
HP NonStop SQL/MP Report Writer Guide—527213-001
3-22
Using Expressions to Calculate Report Values
An expression in the select list can refer to column names, literals, parameter names,
and aggregate functions. These functions are described in Grouping Data for
Calculations on page 3-15.
You can use the following arithmetic operators:
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponentiation (ab)
The order of evaluation of an expression from first to last is:
Expressions within parentheses
Unary operators, plus (+) and minus (-
Exponentiation
Multiplication and division
Addition and subtraction
For a complete description of expressions and syntax rules, see the SQL/MP
Reference Manual.
If you are formatting a report, you can calculate column values in the select list or in a
DETAIL command. Figure 3-6 shows another way to define the previous report by
including expressions in the DETAIL command instead of the select list.
Figure 3-5. Expressions in the Select List
>> VOLUME INVENT;
>> SELECT P.PARTNUM,
+> PARTCOST,
+> PARTCOST * QTY_AVAILABLE,
+> QTY_AVAILABLE * (PRICE - PARTCOST)
+> FROM SALES.PARTS P, PARTSUPP PS, SUPPLIER S
+> WHERE P.PARTNUM = PS.PARTNUM AND PS.SUPPNUM = S.SUPPNUM;
S> LIST FIRST 1;
PARTNUM PARTCOST (EXPR) (EXPR)
212 2000.00 7050000.00 1762500.00
VST0305.vsd