Sybase 2 Barcode Reader User Manual


 
CHAPTER 12 Working with Crosstabs
DataWindow Designer User’s Guide 351
The first step is to determine the expression that, given a salary, returns the next
smaller salary that is a multiple of $10,000. For example, given a salary of
$34,000, the expression would return $30,000, and given a salary of $47,000,
the expression would return $40,000. You can use the
Int function to
accomplish this, as follows:
int(salary/10000) * 10000
That expression divides the salary by 10,000 and takes the integer portion, then
multiplies the result by 10,000. So for $34,000, the expression returns $30,000,
as follows:
34000/10000 = 3.4
int(3.4) = 3
3 * 10000 = 30000
With this information you can build the crosstab. The following uses the
Employee table in the EAS Demo DB:
1 Build a crosstab and retrieve the
dept_id and salary columns.
2 In the Crosstab Definition dialog box, drag the
dept_id column to the
Columns box.
3Drag the
salary column to the Rows box and to the Values box and edit the
expressions.
In the Rows box, use:
int(salary/10000) * 10000
In the Values box, use:
count(int(salary/10000) * 10000 for crosstab)
For more on providing expressions in a crosstab, see “Using expressions”
on page 340.
4 Click OK.