Dynamic Data Analysis on the Web-a Design Approach - Value formatting tags
(Page 7 of 13 )
In the example, the page author has chosen specific presentation tags that he or she knows will suit the result values.
The write tag is used to evaluate data values in its body and include them in the page content.
The valueFromColumn tag references a forRows tag using the rowRef attribute, and extracts a value from a particular column in each row. It is configured with a single dimension or measure tag.
The numberFormat tag expects a numeric value within its body and formats this according to the specified style. The documentation for each data source needs to explain to the page author what type of values are found in each of the dimensions and measures. The set of custom tags for data presentation have to include a range of value formatting tags to meet the needs of the page author.
Table 1. Example output of generalised presentation tags
| Year | Product | Unit Sales | Revenue |
| 2001 | Widget A | 100 | £1,000
|
| 2001 | Widget B | 80 | £1,200 |
| 2001 | Widget C | 60 | £1,100 |
| Year | Product | Unit Sales | Revenue |
| 2002 | Widget C | 80 | £1,650 |
| 2002 | Widget A | 60 | £600 |
| Year | Product | Unit Sales | Revenue |
| 2003 | Widget B | 60 | £900 |
In Table 1, an example of the output generated by the tags in Listing 2 is shown. The table lists sales information covering three distinct years and three products for the sales region of interest. Note that the measures have been aggregated for each unique combination of year and product, resulting in six output rows which have been collected into three slices. The rows are in order of year first, and then by unit sales within year in descending order.
Specialised presentation tags
The generalised tags above will meet the many needs of the page author. However, inevitably specialised presentation requirements will need the development of bespoke function.
Listing 3 shows an example of a bespoke tag designed with specific knowledge of the data it is to work with.
Listing 3. A specialised presentation tag
<%@ taglib uri="/WEB-INF/tlds/dc.tld" prefix="dc" %>
<dc:satisfactionChart id="sattrend" width="100%" dataRef="satdata" aggregation="trend"
monthDimension="Month" yearDimension="Year"
sampleSizeMeasure="NSI Sample Size" lowSampleSizeMeasure="Low Sample Size"
nsiMeasure="NSI" satVSatMeasure="SatVSat">
<dc:title>Net Satisfaction Index (NSI) - Product Diagnostic Survey</dc:title>
</dc:satisfactionChart>
In Listing 3, the satisfactionChart tag references a data tag using the dataRef attribute. The dimensions and measures that the satisfactionChart tag requires are named by attributes, which allows it to work with different data sources with different dimension and measure names, provided the data in those dimensions and measures conforms to its requirements. A chart title is provided using the nested title tag. An example of the output from the satisfactionChart tag is shown in Figure 1.
Figure 1. Example output of a specialised presentation tag

Example output of a specialised presentation tag
Enabling dynamic data analysis
Flexibility in presenting information is half of the equation, but to be truly dynamic, the user has to be given the means to modify the information being presented.
The data-related tags illustrated in Listing 1 lend themselves to dynamic control in a structured, yet versatile way. The OLAP-like model provides a structure which ensures that any resulting query is well-formed and valid. Custom JSP tags, such as those illustrated earlier, provide a number of opportunities for dynamic substitution including:
- Selection of dimensions to be included in the analysis
- Selection of measures to be included in the analysis
- Provision of filtering values to be used to constrain the result data
- Selection of alternative ordering options for the result data
Next: Use of JavaBeans to provide dynamic values >>
More Web Services Articles
More By developerWorks