Kbase P105547: How to display leading zeros on a Crystal Reports field?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
GOAL:
How to display leading zeros on a Crystal Reports field?
GOAL:
Can not see the leading zeros defined in a Progress database on Crystal Reports
GOAL:
Leading zeros for Crystal Reports
FIX:
Create a new function field ( see P105541 )
Paste the following code into the Function Field editor:
// Start Formula
// Specify the desired length of the field in characters (this example uses 8)
numbervar requiredlength:= 8;
// Get the current length of the database field.
numbervar currentlength:= length(totext ({Customer.Cust-Num}, 0, ""));
// Check the length of the database field compared to the required length
if requiredlength < currentlength then
// truncate fields which are longer than the required length
totext ({Customer.Cust-Num}, 0, "")[1 to requiredlength]
else
// pad the field length with underscore characters (0)
// for readability and testing, any added spaces are denoted using underscore characters (0)
replicatestring("0", requiredlength-currentlength) + totext ({Customer.Cust-Num}, 0, "")
// End Formula