- Print
- PDF
Let's look at some examples of common Formatted Column use-cases.
For each of the examples, imagine that the SQL query shown above has been used to retrieve data for a data table.
The data retrieved into the datalayer looks like the example shown above.
Format: Currency
It's often useful to apply the standard Currency format to monetary data.
If we add a Formatted Column element beneath the datalayer, as shown above, set its attributes as shown, and provide another Data Table Column element to display the column added to the datalayer,
the output will change as shown above. In this case, the new column added to the datalayer contains the Freight column values, formatted as Currency.
Format: Short Date
Another common requirement is for date formatting. As we've seen in earlier output examples, the ISO format used to store DateTime values in many databases isn't very presentable.
The example shown above illustrates how a Formatted Column element can be added to format dates using one of the standard date formats, Short Date,
and the resulting output is shown above.
Format: Month Abbreviations
It can be very useful, particularly when working with charts, to have a column that contains the month name abbreviation of a date value.
The example above shows how a custom format can be used; in this case the custom format value MMM will produce a 3-letter month abbreviation,
and the resulting output is shown above. Incidentally, a format value of MM will produce the month number and M will produce the month name and day ("July 15"). All of these must be in uppercase.
As mentioned earlier, formatting data in the datalayer is much more efficient than formatting it elsewhere, so using Formatted Column elements can speed up report performance.