=====================================================================
Printing Zero Values as Blanks on Financial Statements
=====================================================================
PRODUCT: R:BASE VERSION:3.x,4.0,4.5
=====================================================================
AREA: Reports CATALOG: FORMS, REPORTS & LABELS
=====================================================================
R:BASE reports does an excellent job of printing ledger style reports
such as financial statements and trial balances. Break point
processing (grouping) allows the report to easily summarize
the different accounts of the ledger. Commonly, a ledger style report
will show all the account names, but leave blank the debits or credits
if they have a zero balance. This article shows how to easily print
blanks instead of zeros on reports. Take advantage of the new feature
of nesting text functions, with an easy way to produce blanks on zero
balance fields.
Most ledger style reports have one column for debits and another one
for credits. Since we are discussing financial statements, these
fields usually represent currency information. Normally R:BASE would
print $0.00 for a zero value on a currency field. Also, in most ledger
style reports the location that prints would represent an amount that
is the sum of debits or credits. R:BASE would be doing the summing
with a defined variable. The summing variable would always hold a
value or be zero. Therefore, we must find a way for for our zero
values to print blank. R:BASE will let you define some expressions
to make the report print values or be blank instead of printing $0.00.
Here they are:
vdebittot = SUM OF debits
vcredittot = SUM OF credits
3.x, 4.0 expressions
vtextdebit=(CTXT(.vdebittot))
vtextcredit = (CTXT(.vcredittot))
vshow_debittot = (IFEQ(.vdebittot,0,' ',.vtextdebit))
vshow_credittot = (IFEQ(.vcredittot,0,' ',.vtextcredit))
4.5 expressions
vshow_debittot = (IFEQ(.vdebittot,0,' ',CTXT(.vdebittot)))
vshow_credittot = (IFEQ(.vcredittot,0,' ',CTXT(.vcredittot)))
The variables vdebittot and vcredittot are summing the values in the
credit and debit columns of the database table. You would reset them
at the account break.
The CTXT function allows you to change the datatype of the columns to
text. You want the field to be blank when the amount is zero, so the
field will have to be text datatype which allows for blanks.
Fortunately, the logical IFEQ function has the ability to compare
numeric datatypes(like currency) and yet return text values. You can
use the text variable to return the value that is placed on the report
to print.
Instead of locating the debits and credits columns(which are currency
datatype in this example) directly on your report, you would locate
vshow_debittot and vshow_credittot. These variables use the new text
nesting feature to convert the currency values to text as they are
being evaluated within the ifeq logical function.
One important thing to keep in mind is that text fields would normally
print left justified, unlike currency which would print right
justified. You can use picture formatting on the located fields to
right justify the text. All you would need in the picture clause
is [>]. Your report now shows debit and credit totals unless they are
zero and in that case it will show a blank. You have used only two
additional variables in your report. They have added clarity and have
given it the "finished" look.