## Ranks

A rank is a component that is based on the value of another component - a DBField, formula, summary, or parameter. One or more values for these fields can be mapped to an image known as the rank. The rank component allows you to convert raw data values to easy-to-understand graphical cues or to hide sensitive details but still convey the general data value to the report end users.

To insert a rank into a report:

1. Do one of the following:
   - Click Insert > Rank on the menu bar.
   - Click the Insert Rank button on the Insert toolbar.
   - Drag Rank from the Toolbox panel to the report.

   The Rank Expert dialog appears. See the dialog.

   The Rank Resources drop-down list displays the dataset available for the current insertion, and the list box below shows its fields, including DBFields, formulas, summaries and parameters.

2. Select the field you want to insert as rank. You can also create formulas, summaries, and parameters here.
3. Click the Browse button to select an image file to be the default image (used if a value does not fit any of the specified value ranges).
4. Type the alternate text of the default image in the Default Image Alternate Text box, which will be displayed when the image cannot be loaded or is unavailable.
5. In the Value Range box, specify the minimum value, maximum value, image and alternate text respectively in the Minimum, Maximum, Image, and Alternate Text columns. Click or to add or delete a range. To adjust the order of the ranges, click or . A value, which is larger than or equal to the minimum value of a range and less than the maximum value, will be displayed as the image, or the alternate text if the image cannot be loaded or is unavailable. For a value belonging to two or more overlapping ranges, the highest range in the Value Range box will take effect.
6. Click Insert in the dialog, then click the mouse button in the location where you want the rank to be displayed.

Notes:

- Where a rank can be inserted in a report depends on what you have selected as its source.
- You can also create a rank by first inserting a DBField, formula, summary or parameter, and then changing its display type as rank.

### Example

Suppose that you want to define product quality rank based on customer grading, and you want to define three levels:

50-70, Poor

71-90, Good

91-100, Excellent

Specify the following in the Value Range box:

1. In the first range line, set the minimum and maximum values as 50 and 70 respectively in the cells of the Minimum and Maximum columns. Go to the Image cell, and then click <Browse...> to select an image to represent the rank. Click the Alternate Text cell and enter Poor.
2. Click to add another line. Set the minimum and maximum values as 71 and 90, select another image to represent the rank and enter Good in the Alternate Text cell.
3. Add one more line, and set the values, image and name for Excellent in the same way as before.

You have successfully defined a rank for product quality.

See an example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of how each component type could be used in a report. For the rank component example, open `<install_root>\Demo\Reports\SampleComponents\Rank.cls`.