How to Conditionally Format a Numeric FieldLast reviewed: June 27, 1995Article ID: Q104254 |
The information in this article applies to:
SUMMARYYou can create a field in the Expression Builder of a screen or a report to conditionally alter the formatting of a numeric field or variable. See below for more information.
MORE INFORMATIONTo conditionally alter the formatting of a field, you need to combine the IIF() function with the TRANSFORM() function. For example, suppose you have a table with the following field and records:
YTDPURCH 10000 100 500 125000 500000 1200 1200000 50 9000In your report, you want to display the values less than 1000 as plain numbers, the values between 1000 and 100000 as currency with commas, and the values greater than 1000000 as decimal fractions of a million with an "M". To do this, enter the following expression in the Expression Builder of a single field in the Detail band:
IIF(ytdpurch<1000,ytdpurch,IIF(ytdpurch<100000,TRANSFORM(ytdpurch, '$$$,$$$.99'),TRANSFORM(ytdpurch/1000000,'99.9')+'M'))The results will appear as follows:
Ytdpurch $10,000.00 100.00 500.00 0.1M 0.5M $1,200.00 1.2M 50.00 $9,000.00 |
Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a writer
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |