BackPrevious Page Next PageNext

Changing the Display Type of Labels

Displaying a label as Text

Displaying a label as Image

Displaying a label as Barcode

Displaying a label as Rank

JReport Designer provides 13 kinds of display types: Text, Image, Barcode, Rank, Text Field, Hidden Field, Text Area, Checkbox, Radio Button, Image Button, Button, List, and Drop-down List. By changing the display type of a label, you can map the label to other value or image to be displayed instead.

A label in a page report created using query resources can be displayed as one of the following general types: Text, Image, Barcode and Rank. It can also be displayed as a basic web control, including Text Field, Password, Text Area, Checkbox, Radio Button, Image Button, and Button (for details about how to make settings of these display types, see Inserting basic web controls in a page report).

For labels in a web report or library component, only the Text display type is supported.

The Display Type feature is not supported in page reports created using business views.

Displaying a label as Text

  1. Right-click the label and select Display Type from the shortcut menu to open the Display Type dialog.
  2. In the Display As box, select Text.

    Display Type dialog - Text

  3. In the Web Options panel, if you want to specify a tooltip for the text, uncheck the Auto option, then in the Tool Tip text box enter the tooltip you want to show for the text. If you want to use a formula to control the tooltip, click Formula button and select a formula from the drop-down list. If a DBField is selected from the drop-down list, the first record of the field in the database will be used as the tooltip. The tooltip will be displayed when you hover the mouse over the text at server runtime or in HTML results.

    When the Auto option is checked, the tooltip cannot be customized. Then at server runtime or in HTML results, when the text cannot be fully displayed, you can hover the mouse over the text to get its full content in the tooltip.

  4. If needed, bind web actions to the label in the Web Behaviors panel (not available for labels in a web report).

    If the label is in a page report, you can bind the same web actions that are supported on basic web controls to the label.

    If the label is in a library component, the following web actions are supported: Parameter, Filter, Sort, Change Property and Send Message.

    1. Choose a trigger event from the Events column, then click in the Actions column and click Choose button that appears in the text box.
    2. In the Web Action List dialog, select the required action: Parameter, Filter, Sort, Change Property or Send Message, then click OK.

      Web Action List dialog

    3. Define the web action as required.
    4. Click Add button in the Display Type dialog and repeat the above steps to add more web actions. If a web action is not required, select it and click Delete button.
    5. Adjust the order of the added web actions by clicking Move Up button or Move Down button. At runtime, when an event that has been bound with more than one action happens, the upper action will be triggered first.
  5. Click OK in the Display Type dialog to accept the settings on the label.

The following details how to define a specific web action in a library component:

Parameter

The Parameter web action enables you to run a specified library component, especially a library component with parameters using the predefined parameter values when the designated event occurs on the trigger object at runtime.

  1. In the Web Action List dialog, select *Parameter and click OK. The Parameter - Web Action Builder dialog appears.

    Parameter - Web Action Builder dialog

  2. Specify the handler which will receive the parameters of the web action. The handler may be the default one in the current server, or in another server specified by Customized Path.
  3. From the Get Input From drop-down list, specify where to get the input, which may be a parameter form control in the library component, or Other in report.
  4. Specifies whether to apply the action to run a library component or refresh the current library component. If you choose to run a library component, click the Browse button to specify the library component or use a web control in the library component body to retrieve the library component name at runtime, then select the window or frame in which the library component will be opened from the Target Frame drop-down list.
  5. In the parameter box, specify the parameters and the values with which to run or refresh the library component.
  6. Click Add button to add more parameter conditions and specify the parameter names and values according to your requirements.

    When specifying the name and value of a parameter, you can also use web controls to retrieve them from the values of the web controls at runtime, provided that the values of the web controls are valid to create a parameter condition at runtime.

    To delete a parameter condition, select it and click Delete button. To adjust the order of the conditions, make use of Move Up button and Move Down button.

  7. Click OK to accept the parameter values.

Filter

The Filter web action enables you to filter the records of a specified data component based on predefined filter conditions when the designated event occurs on the trigger object at runtime.

  1. In the Web Action List dialog, select *Filter and click OK. The Filter - Web Action Builder dialog appears.

    Filter - Web Action Builder dialog

  2. From the Get Input From drop-down list, specify where to get the input, which may be a parameter form control in the library component or Other in report.
  3. From the Apply Action To drop-down list, select a data component in the current library component, whose records will be filtered.
  4. In the Filter On column, specify the field on which to filter the records. You can also use a web control in the library component body to retrieve the field name at runtime.
  5. Specify the operator to compose the filter condition.
  6. In the Value column, specify the value of how to filter the field. The value may be input by yourself, or be retrieved from of a web control. If a web control is used, you need to make sure its value is one of the specified field's so that a valid filter condition can be created at runtime.
  7. Click Add button to add more filter conditions according to your requirements.
  8. In the More column, specify the relationship between the filter conditions: And or Or.

    To delete a filter condition, select it and click Delete button. To adjust the order of the conditions, make use of Move Up button and Move Down button.

  9. Click OK to accept the filter conditions.

Sort

The Sort web action enables you to sort the records of a specified data component based on predefined sort conditions when the designated event occurs on the trigger object at runtime.

  1. In the Web Action List dialog, select *Sort and click OK. The Sort - Web Action Builder dialog appears.

    Sort - Web Action Builder dialog

  2. From the Get Input From drop-down list, specify where to get the input, which may be a parameter form control in the library component or Other in report.
  3. From the Apply Action To drop-down list, select a data component in the current library component, whose records will be sorted.
  4. In the Sort On column, specify the field in the specified data component by which to sort the records. You can also use a web control in the library component body to retrieve the field name at runtime. If a web control is used, you need to make sure a valid field name can be retrieved from the value of the web control at runtime.
  5. In the Sort Value column, specify the sort direction: Ascending, Descending, or be retrieved from a web control at runtime. If a web control is used, you need to make sure its value is valid for composing a sort condition at runtime.
  6. Click Add button to add more sort conditions and specify the sort-by fields and sort direction according to your requirements.

    To delete a sort condition, select it and click Delete button. To adjust the order of the sort conditions, make use of Move Up button and Move Down button. The order will determine the sort priority of the fields at runtime.

  7. Click OK to accept the sort conditions.

Property

The Property web action is supported in library components only. It enables you to make the properties of an object change when the designated event occurs on the trigger object at runtime.

  1. In the Web Action List dialog, select *Property and click OK. The Change Property - Web Action Builder dialog appears.

    Change Property - Web Action Builder dialog

  2. From the Apply Action To drop-down list, select the object the properties of which you want to change.
  3. In the Properties column, specify the property you want to change. All the properties of the object you select from the Apply Action To drop-down list are listed here.
  4. In the Value column, input the value of the property. You can also use a web control in the library component body to retrieve the value at runtime. If a web control is used, you need to make sure a valid property value can be retrieved from the value of the web control at runtime.
  5. Click Add button to add more property conditions and specify the properties and values according to your requirements.

    To delete a property condition, select it and click Delete button. To adjust the order of the property conditions, make use of Move Up button and Move Down button.

  6. Click OK to accept the property values.

Send Message

The Send Message web action is supported in library components only. It enables you to send out a message from an object at runtime when the designated event occurs on the object for data synchronization. For details about the usage of this web action, see Delivering Messages Between Library Components.

Displaying a label as Image

  1. Right-click the label and select Display Type from the shortcut menu to open the Display Type dialog.
  2. In the Display As box, select Image.

    Display Type dialog - Image

  3. In the Web Options panel, click the Browse button to specify the image source. If you want to use a formula to control the image source, click Formula button and select it from the drop-down list. If a DBField is selected from the drop-down list, the first record of the field in the database will be used as the image source.

    For a DBField, formula, or a summary, you can also check the From DBField radio button to make the value of the DBField/formula/summary the image source. If you choose this option, the Decode Type drop-down list is enabled, from which you can specify the type for decoding the image.

  4. Type the name of the image in the Name text box, or click Formula button and use a formula or DBField to control the name.
  5. Type a string in the Alternate Text text box to serve as content when the image cannot be displayed, or click Formula button and use a formula or DBField to control the alternate text.
  6. In the Tool Tip text box, enter the tooltip you want to show for the image, or click Formula button and use a formula or DBField to control the tooltip. The tooltip will be displayed when you hover the mouse over the image at server runtime or in HTML results.
  7. In the Max Ratio text box, specify the maximum scaling ratio of the image. By default the scaling ratio of the image is not limited. If it is set to any value greater than 0, the actual scaling ratio is less than or equal to it.
  8. Specify the rotation degree of the image in the Rotation text box.
  9. If you want to use customized image size, uncheck Original Size, then set the display width and height of the image in the Width and Height text boxes, check Constrain Proportion to constrain aspect ratio of the image when setting the width and height. Then specify the scaling mode of the image from the Scaling Mode drop-down list.

    The following are the available scaling modes:

  10. In the Web Behaviors panel, bind web actions to the label the same as you do to web controls if needed.
  11. Click OK to accept the settings on the label.

Displaying a label as Barcode

A barcode can also be inserted into a report as a component. For details, see the section Barcodes.

To define the display type of a label as Barcode, follow the steps below:

  1. Right-click the label and select Display Type from the shortcut menu to open the Display Type dialog.
  2. In the Display As box, select Barcode.

    Display Type dialog - Barcode

  3. In the Web Options panel, select the required barcode type from the Symbology drop-down list. You can preview the format of the selected symbology in the Preview box (for details about the different symbologies of barcodes, see Appendix 3: Barcode Symbologies).
  4. In the Tool Tip text box, enter the tooltip you want to show for the barcode. If you want to use a formula to control the tooltip, click Formula button and select a formula from the drop-down list. If a DBField is selected from the drop-down list, the first record of the field in the database will be used as the tooltip. The tooltip will be displayed when you hover the mouse over the barcode at server runtime or in HTML results.

    When the Auto option is checked, the tooltip cannot be customized. Then at server runtime or in HTML results, when the text cannot be fully displayed, you can hover the mouse over the text to get its full content in the tooltip.

  5. From the Scale Mode drop-down list, select the unit for the values of Quiet Zone, Narrow Width, Supplement, Height and Ratio.
  6. Specify the space around the barcode in the Quite Zone text box (most symbologies require quiet zones that precede and follow the barcode).
  7. Change the default value of the barcode in the Default Message text box if necessary. If you check Use Default Message, the message will be used as the barcode value when you view the report result. Otherwise, the message will only be used in design mode.
  8. Specify the supplement of the barcode if necessary.

    If you select the barcode type as Code 39, Code 128/128A/128B/128C or Codabar, you will not need to set the supplement.
  9. Set the barcode bar width in the Narrow Width text box, and the height of the bars in the Height text box.
  10. Specify the width ratio of the thick bar to the thin bar in the Ratio text box if you selected the barcode type as Code 39 or Codabar. The ratio can only be 2.0 or 3.0. Any ratio values not equal to 2.0 or 3.0 will be regarded as 2.0.
  11. Specify the rotation angle in degrees in the Orientation text box if necessary.
  12. Select the Enable Checking Digits checkbox if you want to include check digits in the barcode.
  13. If you selected the barcode type as Code 39, Code 128/128A/128B/128C, or Codabar, then you can check Display HR to display the barcode numbers together with the barcode.
  14. In the Web Behaviors panel, bind web actions to the label the same as you do to web controls if needed.
  15. Click OK to accept the settings on the label.

Displaying a label as Rank

Ranks can also be used as component and inserted into a report directly. For details, refer to the section Ranks.

To define the display type of a label as Rank, follow the steps below:

  1. Right-click the label and select Display Type from the shortcut menu to open the Display Type dialog.
  2. In the Display As box, select Rank.

    Display Type dialog - Rank

  3. In the Web Options panel, 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 a string in the Default Image Alternate Text text box. The string will be displayed when the default image cannot be loaded or is unavailable. If you want to use a formula to control the alternate text, click Formula button and select a formula from the drop-down list. If a DBField is selected from the drop-down list, the first record of the field in the database will be used as the alternate text.
  5. In the Default Tool Tip text box, enter the tooltip you want to show for the default image, or click Formula button and use a formula or DBField to control the tooltip. The tooltip will be displayed when you hover the mouse over the image at server runtime or in HTML results.
  6. Specify the rotation degree of the default image in the Default Image Rotation text box. Note that when you rotate an image, the rectangle that holds the image maintains its original size, which may result in that the image exceeds the field border and therefore the parts that extends outside of the border will be cut off.
  7. In the Value Range box, specify different ranges according to your requirements. For each value range, you should specify the minimum value, maximum value, image, alternate text, tooltip and rotation. 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 apply.

    Click Add button or Delete button to add or delete a range, and Move Up button or Move Down button to adjust the order of the ranges.

  8. In the Web Behaviors panel, bind web actions to the label the same as you do to web controls if needed.
  9. Click OK to accept the settings on the label.

Notes:

BackPrevious Page Next PageNext