Displaying Formatted Text Using the Display Function

The display function allows you to display formatted text and results in the Session Log. Thus, you can write to the Session Log short descriptions of results as well as numerical output formatted according to your specifications. The display function makes it easy to generate report-formatted output or design a template for displaying key information resulting from each run of your program.

An example of a call to the display function is below.

display(LastYrsSales,"Last year's sales = %lg\n")

The first argument of this command is the value to be displayed, LastYrsSales. The second argument, called the format string, includes the leading text "Last year's sales =", the trailing text "\n", and the conversion specification "%lg". "\n" is the new-line character. Because the first argument is an expression, the format string must contain a conversion specification. In this case, the conversion specification is made up of two letters: l (for long floating point numbers) and g (which requests that the expression be written as an integer if possible).

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

Working with Command Statements

Display Function