Under the Data Explorer, double-click on dsetXMLEmployee. Now, Click on
the Computed Columns category.
2. Click on the New... button, and enter the following information:
Column Name: nameCount
Data Type: Integer
Chapter 5
[ 85 ]
3. Click on the function button next to Expression, and enter the
following expression:
var nameLengthCount = 0;
if (row["firstName"])
nameLengthCount = row["firstName"].length;
if (row["lastName"])
nameLengthCount += row["lastName"].length;
nameLengthCount;
4. Hit OK. Now, go down to the Preview Results category. See how the Filter is
only allowing employees with the job title of Developer to be displayed, and
now there is an additional column called nameCount with the number of
letters in each employee's name.
The example just shown is not very useful in most reports, but it does demonstrate
the Filter and Computed Column functionality. Computed Columns become
more useful when dealing with numerical data that you may need to perform
aggregation on.
Working with Data
[ 86 ]
Data Set for Flat Files
Next, we are going to create a Data Set based on the Flat File Data Source. This
interface will look a little different than the XML Data Source, but the basic idea
is still the same. We will define each column's name and data type, and create any
filters or computed columns that are necessary.
Pages:
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101