Changing a Field Format


Changing the display or output format of fields that have been placed on the canvas or in field containers allows you to control how values in a field are interpreted and the styling that they use when displayed. This feature allows for field display formatting, which is essential for any data-based content design tool.

In a report, the field format is reflected in the format of data values. In a chart, the field format may be reflected in data values in the chart, if they are displayed, or in the tooltip. Note that series based data labels in a chart are formatted independently from the field itself.

Note: These formatting options are applied when the WebFOCUS Server retrieves data from the data source. When that data is passed to the JavaScript chart engine to generate a chart, some formatting information may not be included and replaced with default settings. For reports, the selected field formatting options are passed directly.

To change the format of a field in a bucket on the Properties panel, right-click the field and point to Format data, as shown in the following image.


Note: When editing the format of a field, the only options available are those that are relevant to the selected field.

When creating or editing a calculated field, you can access Data Format options by clicking the Edit Format button, which appears with a different icon depending on whether the field is a number , character , or date field , and which is located above the Operator Selection pane next to the field name, as shown in the following image.


Format options for a COMPUTE

To edit the format of a field, first select the data type, then set details specific to that data type. In the following image, the numeric data type is selected, providing options for numeric fields.

You can select one of the following data types:

  • Character format, for fields containing letters and numbers.
  • Number format, for fields containing numbers that you want to sum or aggregate.
  • Date format, for fields containing dates.
  • Other format, for fields that have values that do not match one of the other formats, such as date-time fields or string fields, or are a variety of another type of field, such as packed decimal fields or Julian date fields.

When you select the character data type, you can specify character-specific formatting, as shown in the following image.

You can use the Length option to select the number of characters to display in the field, and enable variable length. Variable length indicates that the number of characters can vary depending on the data that is stored in the field.

When you select the numeric data type, you can specify number-specific formatting, as shown in the following image.

You can choose whether or not to display decimals, and set the maximum number of digits to show before and after the decimal point. You can also choose how to format negative numbers, whether to show thousands separators, and whether to show a zero before the decimal point when the value is less than one.

You can also specify currency and percent variations, such as a different currency symbol or a change in the use of a percentage value. When you select the currency option under Type, the Currency symbol and Symbol position options appear, allowing you to select the currency symbol and how it displays. When changing the format of a numeric field, a preview shows an example of what data values may look like based on the current field format settings.

Note: The Percent data format option automatically multiplies the field value by 100 so that decimal values are accurately converted to percentages. If your data values do not need to be multiplied by 100 and only need the percent symbol (%) added, select the custom format data type and manually enter a field format followed by %. For example, D12.2%.

When your data type is a date field, you can make a selection from the supported date formats that are available for selection. The options for a date field are shown in the following image.


Date format options

The Date format menu shows a list of date formats as applied to December 31 of the current year. You can select date formats that use separators or month names, or show a single date component.

When you select a date format that uses a separator, the Date separator menu is available. You can choose to use a slash (/), dash (-), dot (.), or space.

If you want to use a format not available in the character, number, or date sections, you can select the Other data type. Type a valid WebFOCUS field format into the Format text box. For example, the following image shows a field using the format HMDYYS, which is a date-time format.


Setting an Other data type

The Other data type, like all of the other data types, does not allow field transformations, which prevents invalid formats. If the field was originally alphanumeric, you can enter a custom alphanumeric format. If the field was originally numeric, you can enter a custom numeric format. If the field was a originally a date field, you can enter a custom date format.

Procedure: How to Change the Number of Decimal Places in a Field

You can change the number of decimal places that display for a numeric field to show fewer or more decimal values. Showing more decimal values allows you to analyze your data with greater precision, while showing fewer decimal values may help make information more immediately digestible.

  1. Open WebFOCUS Designer. On the WebFOCUS start page, click the plus menu and then click Create Visualizations, or, on the WebFOCUS Home Page, click Visualize Data.

    WebFOCUS Designer opens in a new browser tab.

  2. Select a workspace with access to the wf_retail sample data, and select wf_retail_lite.mas as the data source.

    WebFOCUS Designer loads with options to create a single content item.

  3. Change the content type to a report. In the Content picker, select one of the report layouts.

    Using a report makes it easy to see all data values directly on the canvas. If you are creating a chart, you can see exact data values when you point to a section of the chart to display a tooltip.

  4. Add a sort field, for example, Product Category, to the Row bucket and a measure field, for example, Revenue Per Sq. Ft., to the Measure bucket.
  5. Change the format of the measure field to show four digits after the decimal point, by doing the following:
    1. In the Measure bucket, right-click a field and point to Format data, as shown in the following image.


      Right-clicking the field in the Measure bucket

    2. If the field is not already in a numeric format, change the data type to numeric by clicking the number button in the Data type section, as shown in the following image.


      Selecting the numeric data type

    3. To display decimals, ensure that the integer option is not selected in the Type section. You can select the decimal, currency, or percent option depending on how you want the field to display.
    4. To change the number of digits after the decimal, use the arrow control to increase or decrease the Decimal place value, or type a number in the text box.
    5. Check the data preview in the Sample data text box. If it shows the symbols and the number of values that you want to display in your content, click OK to accept your format changes.

The field whose format you modified now shows the specified number of decimal points, as shown in the following image.


Finished report with 4 decimal places