How To Format Numeric Fields And Numeric Variables
This topic discusses formatting numeric fields and numeric variables.
Numeric codes can be justified and spaced as described in the
topic How To Format Text Fields and Text Variables. Refer to that topic
for information regarding right and left justifying and padding of fields.
In addition to these basic formatting symbols, there are other formatting
options, listed below, that apply to NUMERIC fields and NUMERIC variables.
The following formatting information applies to
numeric variables as well as numeric fields.
<t> |
Print Numbers as Text.
Numeric fields will be printed as words.
Example: @de.pr<t> prints 1056.13 as 'One Thousand Fifty Six'.
This can be used in check-writing.
|
<.> |
Print Fractional Part of Number Only.
In numeric fields with decimal points, you may want to
print only the fractional part. (for example, pennies
in currency fields)
Example: @de.pr<.> prints 1056.13 as '13'. |
<!> |
Print Whole Part of Number Only.
In numeric fields with decimal points, you may want
to print only the whole part. (for example, dollars in
currency fields)
Example: @de.pr<!> prints 1056.13 as '1056'. |
<.nn> |
Print Fractional Part in nn Spaces.
In numeric fields with decimal points, you may want to
print only the fractional part, padded with spaces if
needed.
Example: @de.pr<.04> prints 1056.13 as ' 13'. |
<!nn> |
Print Whole Part in nn Spaces.
In numeric fields with decimal points, you may want
to print only the whole part (for example, dollars in
currency fields.) This code will only print as many
as (nn) places, padding with spaces if needed.
Example: @de.pr<!03> prints 1056.13 as '056'. |
<0nn> | Zero Fill-In nn Spaces.
Remove decimal point and commas and pad to nn spaces.
Examples: @de.pr<010> prints 1234.56 as '0000123456'.
@de.pr<05> prints 1776.13 as '77613'. |
<n.0> |
Print in n Spaces and Print 0 rather than a blank if the
number is zero. Spaces are counted including
'$' and ','
Zero currency fields are shown as 0.00.
If the number is larger than n spaces, the # symbol
is printed instead.
Examples: @de.ow<10.0> prints $1,234.56 as
' $1,234.56'.
@de.ow<10.0> prints 0.0 as '0.00'.
@de.ow<5.0> prints $1,234.56 as ##### since the
actual space count is greater than n (5). |
<n.nn> |
Print in n Spaces to nn Decimal Places. Print 0 rather than a
blank if the number is zero.
Zero currency fields are shown as 0.00.
If the number is larger than n spaces, the # symbol
is printed instead.
Examples: @de.ra<10.01> prints 333.123 as
' 333.1'.
@de.ra<10.03> prints 333.123 as
' 333.123'.
@de.ow<6.01> prints 1234.56 as ###### since the
total number of spaces needed to display the number
is greater than nn (06). This includes the decimal point. |
<0> |
Print in the Default Field Width and Print 0 rather than a
blank if the number is zero.
Zero currency fields are shown as 0.00.
Examples: @de.ow<0> prints 1234.56 as '1234.56'.
@de.ow<0> prints 0.0 as '0.00'. |
<s> |
Causes everything but numerics to be stripped from
a CURRENCY $$$ field before printing. Collect! retains the "."
and, in negative balances, the "-"
This is good for cleaning up currency (when ' Multi Currency'
is switched ON in Company Details.)
Examples: @de.ow<s> prints $1,234.56 as '1234.56'. |
>n.nn> |
Right Justify and print in n Spaces to nn Decimal Places.
Print 0 rather than a blank if the number is zero.
Zero currency fields are shown as 0.00.
If the number is larger than n spaces, the # symbol
is printed instead.
Examples: @de.ra>10.01> prints 333.123 as
' 333.1'.
@de.ra>10.03> prints 333.123 as
' 333.123'.
@de.ow>6.01> prints 1234.56 as ###### since the
total number of spaces needed to display the number
is greater than nn (06). This includes the decimal point. |
<n.nn< |
Left Justify and print in n Spaces to nn Decimal Places.
Print 0 rather than a blank if the number is zero.
Zero currency fields are shown as 0.00.
If the number is larger than n spaces, the # symbol
is printed instead.
Examples: @de.ra<10.01< prints 333.123 as
'333.1 '.
@de.ra<10.03< prints 333.123 as
'333.123 '.
@de.ow<6.01< prints 1234.56 as ###### since the
total number of spaces needed to display the number
is greater than n (06). This includes the decimal point. |
Dollar Signs
If you would like to automatically control currency signs when you
display currency fields, switch ON the ' Multi Currency' switch in the
Company Details form. When this is switched ON, Collect! uses
your Regional Settings in your Windows system. First, you would
set up your Regional Settings to show the currency symbols, (e.g.
dollar signs), or not, as you wish. Then, when the 'Multi Currency'
switch is ON, Collect! would use the regional settings to determine
how to display your numbers. With this switch OFF, you manually
control how you display your numbers in reports and letters. This
means you would have to manually type in the dollar signs in your
report body. You can switch this ON or OFF, as needed, for a
particular report.
Select OPTIONS from the top menu bar and a list of choices
is displayed. Select COMPANY DETAILS to display the Company Details
form.
Assigning Formatted Numeric Fields To A Variable
You can also assign a formatted numeric field to a variable. This
works for any printable information numeric field. Any of the
numeric formatting operators may be used.
Example:
@varStr* = @de.pr<010>
If the Debtor's Principal is 1234.56, then @varStr now
holds '0000123456'.
And you can apply formatting when assigning one variable
to another.
Example 2:
@varStr* = @(de.pr+de.fe)
@varStr2* = @varStr<015>
The first string totals the Debtor's Principal and Fees.
The value in @varStr2 is the value that was in @varStr
plus now it is padded with zeroes up to 15 spaces.
If the Debtor's Principal and Fees total 1834.56, then @varStr2
now holds '000000000183456'.
This is very useful when creating special reports
for electronic processing where data must meet special
formatting requirements.
Summary
Reports that ship with the demonstration database use these formatting
techniques. Please view the Report Definitions list to find reports and
letters.
See Also
- How To Format Text Fields And Text Variables
- How To Format Variables When Assigning
- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter topics
|
Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.
Please click this link to send us your comments: helpinfo@collect.org