PANTHEON™ Help

 Toc
 PANTHEON Help - Welcome
[Collapse]PANTHEON
 [Collapse]Guides for PANTHEON
  [Collapse]Guide for PANTHEON
   [Collapse]Settings
    [Expand]Subjects
    [Expand]Items
    [Expand]POS
    [Expand]Manufacturing
    [Expand]Personnel
     Calendar
    [Expand]Financials
    [Expand]Customs
    [Collapse]Program
     [Expand]Document Types
     [Collapse]Reports in PANTHEON
       Settings in Administration Panel
      [Expand]Reports Register
       Print Preview
      [Expand]Report Designer
      [Expand]Creating Reports
      [Expand]Groups and Aggregates
      [Collapse]Formatting and Highlighting
        Formatting
        Highlighting
       Nested Reports (Subreports)
      [Expand]Specifics of Printouts in PANTHEON
      [Expand]Script
       Report Design Considerations
      Document Texts
      Delivery Methods
     [Expand]Loyalty Cards
     [Expand]Administration Panel
     [Expand]Dashboard Components
      Dashboard Reports
      Ad-hoc analysis
     [Expand]ARES
      SQL urejevalnik
    [Expand]Documentation
    [Expand]Change User
   [Expand]Orders
   [Expand]Goods
   [Expand]Manufacturing
   [Expand]POS
   [Expand]Service
   [Expand]Financials
   [Expand]Personnel
   [Expand]Analytics
   [Expand]Desktop
   [Expand]Help
   [Expand]Messages and Warnings
   [Expand]Additional programs
   [Expand]Old products
  [Expand]Guide for PANTHEON Retail
  [Expand]Guide for PANTHEON Vet
  [Expand]Guide for PANTHEON Farming
 [Collapse]User Manuals for PANTHEON
  [Expand]User Manual for PANTHEON
  [Expand]User Manual for PANTHEON Retail
  [Expand]User manual for PANTHEON Vet
  [Expand]User Manual for PANTHEON Farming
[Collapse]PANTHEON Web
 [Collapse]Guides for PANTHEON Web
  [Expand]Guide for PANTHEON Web Light
  [Expand]Guide for PANTHEON Web Terminal
  [Expand]Guide for PANTHEON Web Legal
  [Expand]Old products Archive
 [Collapse]User Manuals for PANTHEON Web
  [Expand]Getting started PANTHEON Web
  [Expand]User Manual for PANTHEON Web Light
  [Expand]User Manual for PANTHEON Web Terminal
  [Expand]User Manual for PANTHEON Web Legal
  [Expand]Old products Archive
[Collapse]PANTHEON Granules
 [Collapse]Guides for PANTHEON Granules
  [Expand]Personnel Granule
  [Expand]Travel Orders Granule
  [Expand]Documents and Tasks Granule
  [Expand]Dashboard Granule
  [Expand]B2B Orders Granule
  [Expand]Field Service Granule
  [Expand]Fixed Assets Inventory Granule
  [Expand]Warehouse Inventory Granule
 [Collapse]User Manuals for PANTHEON Granules
  [Expand]Getting started
  [Expand]Personnel Granule
  [Expand]Travel Orders Granule
  [Expand]Documents and Tasks Granule
  [Expand]B2B Orders Granule
  [Expand]Dashboard Granule
  [Expand]Field Service Granule
  [Expand]Fixed Assets Inventory Granule
  [Expand]Warehouse Inventory Granule
  [Expand]Archive
[Expand]User Site

Load Time: 562.4997 ms
"
  1006293 | 218653 | 354821 | Published
Label

Formatting of values

Formatting

A feature of aggregate functions is that the returned numerical values are not formatted, as shown by the first example, which uses “SUM”:

_img141

Data fields usually return a formatted value, which is simply displayed by the “Text” object without any change. To apply formatting to the “SUM” result, let's use the value formatting tools in designer.

Select the object containing the sum and open the format editor either from 'Display Format...' in its context menu or through the “DisplayFormat” property in the Object inspector.

This editor lists the format categories on the left, the corresponding formats on the right and the format string and decimal separator for the selected category and format below. We’ll select the “Number” category and "$1,234.50" format. The format string is an argument for the Delphi "Format" function, which FastReport uses to implement number formatting. The format string and decimal separator can be changed. If the decimal separator is left blank then the current regional setup value is used.

After clicking ОK and previewing the report you will see that the Sum in the report is now formatted correctly:

_img143

Note the combobox at the top of the dialogue form. If we have more than one expression in an object, we may set different formatting for each expression.

As you can see on the picture the following formatting categories are available:

  • Text (no formatting)

  • Number

  • DateTime

  • Boolean

If no formatting is selected for date and time data, they will be display in the format specified in the Windows OS.

000001.gif
  • You can manually enter format which is not available in the list.
  • You can use format strings supported by program for editing spreadsheet Excel.
  • Format specifications do not affect the data format that is set in the script.
  • Format specifications do not effect data stored in the database.

Format Strings

Using the example, re-size the footer and its object and change the object text to this:

Total: [SUM(<Group."ItemsTotal">,MasterData1)]

Number: [COUNT(MasterData1)]

The total and the number of orders will be displayed in the object.

In the report preview both of these values are shown in monetary format, which we had previously set. This is incorrect:

_img144

To display each value in its correct format they need to be formatted individually. To do this we use format tags, which are placed just before the closing square bracket of the expression. In our example, disable formatting for the object (select “Text (no formatting)” category in the format editor). Now we need to specify the format for just the first expression, as the second one will be displayed correctly by default (i.e. as an integer). Change the object text as follows:

Sum: [SUM(<Group."ItemsTotal">,MasterData1) #n%2,2m]

Number: [COUNT(MasterData1)]

Preview the report to make sure that the object is displayed correctly:

_img145

The general syntax of format tags is:

[expression #formattag]

Note that the space character between the expression and the “#” symbol is mandatory! The format tag itself might look like:

#nformat_string – numerical format

#dformat_string – date/time format

#bFalse,True – boolean format

Format_string in each case is the argument to the function used for formatting. So, for numerical formatting the Delphi Format function is used, and for date/time the 'FormatDateTime' function. The syntax for these functions can be found in the Delphi help system. Below are several values used in FastReport:

for numerical formatting:

%g – number with the minimal places after the decimal point

%2.2f – number with a fixed number of places after the decimal point

%2.2n – as previous, but with thousands separator

%2.2m – monetary format, accepted by the Windows OS, dependent on the regional settings in the control panel

000001.gif Be careful when using format %2.2m. It is correct only for amounts in domestic currency!

A comma or a dash can be used instead of the dot in the format_string for numerical formatting. This symbol is used as the separator between the integer and the fractional parts of the value. Any other character is not allowed.

Excel numeral formatting examples:

Format Result example
#0.00  1234,56
#,##0.00 1.234,56
#0 1235

for date/time formatting:

Format Result example
dd.mm.yyyy  date as 05.06.2008
d.m.yy date as 5.6.08
dd mmm yyyy date as 05 Jun 2008
dd mmmm yyyy date as 05 June 2008
ddd date as Thu
dddd date as Thursday
hh:mm time as 08:07
hh:mm:ss time as 08:07:06
dd mmmm yyyy, hh:mm date and time as 5 June 2008, 08:07:06

For formatting with the “#b” type (boolean), the format_string is entered as two values separated by a comma. The first value corresponds to “False” and the second to “True”.

Inline Formatting and Format Functions

For formatting we can also use functions that we write in the code. For example consider function "FormatFloat" to format numbers.

The following expressions write out the whole part of the number and its first two decimal places:

[FormatFloat('#0', Int(n)]
[FormatFloat('00', Round(100 * Frac(n))))]


Data formatting can also be done within the expression (inline formatting), as shown in the example below

Today is [NOW #d dddd], [NOW #d d.m.yyyy], the time is [NOW #d hh.mm.ss].

In the "RichText" object inline formatting is the only possible way of formatting.

 

Rate this topic
Was this topic usefull?
Comments
Comment will also bo visible in forum!