// Start Formula
// Specify the desired length of the field in characters (this example uses 20)
numbervar requiredlength:= 20;
// Get the current length of the database field.
numbervar currentlength:= length({Customer.Customer Name});
// 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
{Customer.Customer Name}[1 to requiredlength]
else
// pad the field length with underscore characters (_)
// for readibility and testing, any added spaces are denoted using underscore characters (_)
{Customer.Customer Name} + replicatestring("_", requiredlength-currentlength)
// End Formula