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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field still included when it is to long

Status
Not open for further replies.

cunner26

Technical User
Nov 18, 2002
9
CA
I am currently working on an ASCII type report. The field I am working with is the city field. The report requires this field to be 20 characters in length, but some of the city names are 21-25 characters in length. I have tried using the following formula,

if IsNull ({usrCity.Desc1}) then "____________________" else
if length ({usrCity.Desc1}) = 1 then
Picture ({usrCity.Desc1},"x___________________" ) else
if length ({usrCity.Desc1}) = 2 then
Picture ({usrCity.Desc1},"xx__________________" ) else
if length ({usrCity.Desc1}) = 3 then
Picture ({usrCity.Desc1},"xxx_________________" ) else
if length ({usrCity.Desc1}) = 4 then
Picture ({usrCity.Desc1},"xxxx________________" ) else
if length ({usrCity.Desc1}) = 5 then
Picture ({usrCity.Desc1},"xxxxx_______________" ) else
if length ({usrCity.Desc1}) = 6 then
Picture ({usrCity.Desc1},"xxxxxx______________" ) else
if length ({usrCity.Desc1}) = 7 then
Picture ({usrCity.Desc1},"xxxxxxx_____________" ) else
if length ({usrCity.Desc1}) = 8 then
Picture ({usrCity.Desc1},"xxxxxxxx____________" ) else
if length ({usrCity.Desc1}) = 9 then
Picture ({usrCity.Desc1},"xxxxxxxxx___________" ) else
if length ({usrCity.Desc1}) = 10 then
Picture ({usrCity.Desc1},"xxxxxxxxxx__________" ) else
if length ({usrCity.Desc1}) = 11 then
Picture ({usrCity.Desc1},"xxxxxxxxxxx_________" ) else
if length ({usrCity.Desc1}) = 12 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxx________" ) else
if length ({usrCity.Desc1}) = 13 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxx_______" ) else
if length ({usrCity.Desc1}) = 14 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxx______" ) else
if length ({usrCity.Desc1}) = 15 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxx_____" ) else
if length ({usrCity.Desc1}) = 16 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxxx____" ) else
if length ({usrCity.Desc1}) = 17 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxxxx___" ) else
if length ({usrCity.Desc1}) = 18 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxxxxx__" ) else
if length ({usrCity.Desc1}) = 19 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxxxxxx_" ) else
if length ({usrCity.Desc1}) = 20 then
Picture ({usrCity.Desc1},"xxxxxxxxxxxxxxxxxxxx" ) else ""

I have tried using the same pattern as above and putting the length equal to 21 but keeping the picture funtion to 20 spaces but this does not seem to work. The field continues to keep its original length which is to long.

Any assistance would be great, thanks,

 
I just answered this question yesterday from another visitor. Is this a homework assignment?

Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
You did assist in a similar question yesterday. That was for the isnull's and how to have blank spaces appear if there is nothing in the field. This is not a homework assignment. I have tried a few different variations of the above since I posted this question. I have tried the following:

If isnull({ee.Employee.city}) then replicatestring ("_",25) else if length({ee.Employee.city}) >25 then picture({ee.employee.city},"XXXXXXXXXXXXXXXXXXXXXXXXXXXX") else if Length ({ee.Employee.city}) =1 then picture({ee.Employee.city},"x_________________________")
and so on up to 25 spaces.

The problem lies in that the city name will go over the desired length 25 and I am looking for a way in which to cut it off at 25 and not have it go past that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top