BOFocus – Crystal Reports Tips – Tricks – Tutorials

Crystal Reports - Formulas

Add Padding to a field

At times in may be necessary to add padding to a field. Some examples would be an export from Crystal Reports to Excel or a CSV file for importing the data from one system to another. Below are two examples on how to accomplish this task.

Example #1:

Fields needs to be 14 characters with spaces to the left:

Numbervar a:= Length(Trim({Credit.Credit Authorization Number}));
Space(14 – Numbervar a) & Trim({Credit.Credit Authorization Number});

Example #2:

Field needs to be 14 charters with ‘0’s filling in any blank charters to the right:

Stringvar a := {Credit.Credit Authorization Number} + “00000000000000″;
a [1 to 14]

Tagged ,

One thought on “Add Padding to a field

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

GET SOCIAL

QUICK TIP

Use the Chart Sort Order dialog box to sort and group your chart data. This dialog box appears when you click the Order button on the Data tab of the Chart Expert for a chart with the Advanced layout type.

ADVERTISMENT