Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Length

Status
Not open for further replies.

wanzek

Technical User
Mar 8, 2010
58
US
I am creating a file that need to be uploaded to a website and each field needs to be an exact length. For example the last name fields need to be a total of 20 characters.

Johnson
Anderson
Brown

Is there a formula that will take however many characters the name field already is and add spaces to the end to get to 20 characters?
 
i am not in front of crystal, so can't test this, but it should be close.

{@AddSpacesToEnd}
stringvar spaces := " ";
numbervar lenfield := len(trim({table.field}));
{table.field}&(left(spaces,(20-lenfield)))

 
Never mind I got it to work using:

left({@Name},40) + (
if len({HRDP.Name}) < 40 then
space(40-len({HRDP.Name}))
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top