FPRINT: Displaying a Value in a Specified Format

How to:

Given an output format, the simplified conversion function FPRINT converts a value to alphanumeric format for display.

Note: A legacy FPRINT function also exists and is still supported. For information, see FPRINT: Converting Fields to Alphanumeric Format. The legacy function has an additional argument for the name or format of the returned value.

Syntax: How to Display a Value in a Specified Format

FPRINT(value, 'out_format')

where:

value

Any data type

Is the value to be converted.

'out_format'

Fixed length alphanumeric

Is the display format. For information about valid display formats, see the Describing Data With WebFOCUS Language manual.

Example: Displaying a Value in a Specified Format

The following request displays COGS_US as format 'D9M', and TIME_DATE as format 'YYMtrD', by converting them to alphanumeric using FPRINT.

DEFINE FILE WF_RETAIL_LITE
COGS_A/A25 = FPRINT(COGS_US, 'D9M');
DATE1/A25 = FPRINT(TIME_DATE, 'YYMtrD');
END
TABLE FILE WF_RETAIL_LITE
PRINT LST.COGS_US COGS_A  DATE1
BY TIME_DATE
WHERE RECORDLIMIT EQ 10
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.