Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step tutorials and online videos.

Click Here To Learn More »

9.05 Fomatting Values

Formatting Values for Output

When formatting output to be displayed in a report, the output is usually a combination of string data variables. As the last section stated, Basic syntax is a type safe language. As a result, you can’t concatenate strings with numbers or dates. To build an output string with a combination of data types, you have to convert everything to a string using the CStr() method. This method takes all data types and converts them to a string.

The CStr() function is usually passed the value to format as the first parameter and the formatting string as the second parameter. The formatting string is used as a template that describes how the value should look when it gets converted as a string. Table 9-6 shows the different formatting characters that can be used. Table 9-7 shows examples of how different values will look after being formatted.

Table 9-6. CStr() Formatting Characters

Format Description
# Use with formatting numbers. If the number isn’t large enough, then spaces will be used instead. If the number is too large, then the integer part will still be fully displayed. Unused digits after the decimal are zero filled.
0 Use...

Get UNLIMITED Crystal Reports Online Training!

Click Here To Start Your Training!

1500+ Tutorial Pages

Complete Crystal Reports Online Training with over 1,500 pages of better than book quality Crystal Reports tutorials.

Step-by-step Online Videos

Learn at your own pace from the comfort of your home! Pause, rewind and watch online training videos anytime!

Online Community

Members-only community where you can post and answer questions. The community is checked on a regular basis by best selling Crystal Reports book author Brian Bischof to help answer your questions.

Cut & Paste Source Code

Save time with simple cut and paste source code you can use right now in your next report!

Click Here To Start Your Training!