A script-enabled browser is required for this page to function properly.

<field> XML tag

The <field> tag defines a field in the layout of the report definition and assigns attributes to it. The <field>tag must be nested within the <layout> tag. Most of the other layout tags require a <field> nested within them (for example, <tabular>, <group>, and <matrixCell>). The <field> tag modifies existing fields in an report definition (.rdf) file, if you use the same field name. Otherwise, it can be used to create an entirely new field in the report.

The <field>tag can also contain the <labelAttribute> and <exception> tags.

You can end the <field>tag with /> or <field>. The latter is the method you must use if you are including a <labelAttribute> and <exception> inside the <field>tag. The example below illustrates both methods of ending the <field>tag.

<field name="f_deptno" label="Department" 
  source="deptno"/>
<field name="f_mgr" label="Manager" 
  source="mgr">
  <labelAttribute textColor="red" alignment="center"/>
</field>

Syntax

<field name="field_name"
  source="source_column"
  [label="field_label"]
  [currency="currency_symbol"]
  [tsep="separator_character"]
  [formatTrigger="plsql_program_unit"]
  [font="font_name"]
  [fontSize="point_size"]
  [fontStyle="regular | italic | bold | boldItalic"]
  [fontEfffect="regular | strikeout | underline 
    | strikeoutUnderline"]
  [lineColor="color_name | noLine"]
  [fillColor="color_name | noFill"]
  [textColor="color_name"]
  [alignment="start | left | center | right | end"]
  [hyperlink="URL"]
  [linkdest="hyperlink_target"]
  [formatMask="mask"]
/> | >[other_tags]</field>

Parameters /Options

Description

name

Is the identifier for the field. If the name matches that of a field in an .rdf file to which the XML is being applied, then the attributes specified overrides those in the .rdf file.

source

Is the source column from which the field gets its data. The source column must exist in the data model.

Required, for creating new fields.

Optional, for modifying existing fields.

label

Is the boilerplate text to be associated with the field. To control the formatting attributes of the label, you must use the <labelAttribute> tag.

The label attribute only affects new fields, it does not change the label of an existing field in the .rdf file. To change the label of an existing field, you can use the <object> tag.

currency

Is the currency symbol to be used with the field (for example, $). You must still specify the formatMask attribute to indicate where you want the currency symbol placed.

tsep

Is the separator character that you want to use when generating delimited output. The most commonly used delimiter is a tab, which can be read by spreadsheet applications such as Microsoft Excel.

formatTrigger

Is the name of a PL/SQL program unit that is to be used as the format trigger for the field. Format triggers must be functions.

font

Is the name of the font to be used for the field contents.

fontsize

Is the size of the font to be used for the field contents.

fontstyle

Is the style of the font to be used for the field contents.

fonteffect

Is the effect of the font to be used for the field contents.

linecolor

Is the name of the color to be used for the border of the field. If noLine is specified, then the field’s border is transparent (that is, invisible).

fillcolor

Is the name of the color to be used as the background for the field. If noFill is specified, then the background is transparent.

textColor

Is the name of the color to be used for the field contents.

alignment

Is how the text should be justified within the field.

hyperlink

Is a URL to be associated with the field contents when HTML or PDF output is generated. This attribute is ignored for other types of output such as PostScript or ASCII.

linkdest

Is the target to be used when hyperlinking to this field’s contents. This attribute is only used when generating HTML or PDF output. It is ignored for other types of output such as PostScript or ASCII.

formatMask

Is the format mask to be applied when displaying the field’s contents. For more information on the format mask syntax, refer to Specifying date and time format masks and Specifying number format masks.

Examples

The following example shows a section in the layout of a report definition that defines fields within two break groups for a matrix report:

<group>
  <field name="f_quarter" source="quarter" 
    label="Quarter:" 
    font="Arial" fontSize="8"
    formatTrigger="F_quarterFormatTrigger">
    <labelAttribute 
      font="Arial" fontSize="8" 
      fontStyle="bold" textColor="black"/>
  </field>
  <field name="f_SumTOTAL_SALESPerQUARTER"
    source="SumTOTAL_SALESPerQUARTER"
    label="Qtrly: Sales: " 
    font="Arial" fontSize="8" 
    fontStyle="bold"
    formatMask="LNNNGNNNGNNNGNN0D00">
    <labelAttribute 
      font="Arial" fontSize="8"   
      fontStyle="bold" textColor="black"/>  
  </field>
  <field name="f_SumTOTAL_COSTPerQUARTER" 
    source="SumTOTAL_COSTPerQUARTER"
    label="Costs: " 
    font="Arial" fontSize="8" fontStyle="bold"    
    formatMask="LNNNGNNNGNNNGNN0D00">
    <labelAttribute 
      font="Arial" fontSize="8" 
      fontStyle="bold" textColor="black"/>
  </field>
  <field 
    name="f_SumTOTAL_PROFITPerQUARTER"
    source="SumTOTAL_PROFITPerQUARTER"
    label="Profits: " font="Arial" fontSize="8" 
    fontStyle="bold"
    formatMask="LNNNGNNNGNNNGNN0D00">
    <labelAttribute 
      font="Arial" fontSize="8"   
      fontStyle="bold" textColor="black"/>
    </field>
</group>
<group>
  <field name="f_state" 
    source="state" label="State:"
    font="Arial" fontSize="8">
    <labelAttribute font="Arial" 
      fontSize="8" 
      fontStyle="bold" textColor="black"/>
  </field> 
</group>

The following example shows a section in the layout of a report definition that defines a field within a break group for a group left report. The formatTrigger attribute points to a function that would be defined within the <programUnits> tag.

<group>
  <field name="f_quarter1" source="quarter1" 
    label="Quarter" 
    font="Arial" fontSize="8"
    formatTrigger="F_quarter1FormatTrigger">
    <labelAttribute 
      font="Arial" fontSize="8" 
      fontStyle="bold" textColor="yellow"/>
  </field>
</group>

See also

About XML in reports

Oracle Reports XML tags